Document broken when updating to 1.7.16 or higher

I’ve migrated and maintained our whole beer production management into grist (1.7.12 self hosted on yunohost) and it’s been a blast !

However when trying to update to a more recent 1.7.17 the whole document is broken and no modification, line creation or deletion is allowed, anything i try triggers this kind of error : [Sandbox] KeyError 'Name_of_whichever_table_i_try_to_alter' and [Sandbox] AttributeError 'DocModel' object has no attribute 'tables' or [Sandbox] AttributeError 'DocModel' object has no attribute 'columns'.

I tried to delete every blank line that i found in formulas (as suggested here) without success. Not sure what more i can do on my own…

Thanks for reporting this @Enthouane ! I can replicate with GRIST_SANDBOX_FLAVOR=pyodide, this may be a subtle Python 3.12 change in f-string tokenization.

Is it possible you have a formula containing an f-string whose source text spans more than one line? If so, a work-around would be to write that in another way.

Will follow up on understanding and fixing this.

Yes i have some f strings in formulas, i’ll check that and report back…

So i’ve narrowed down to a single formula containing f strings.

My testing environment is :

  • the production server at work containing the document (and the f strings) : critical, cannot play with it updating and rolling back as i please
  • my personnal grist server at home, which is already in 1.7.17

Here is what i tried : delete the incriminated formula on the production server, export the document, undo to restore the formula, import the document into the personnal server. But now when importing it i’ve got a Request to ``https://domain.tld/dw/self/v/unknown/o/docs/api/workspaces/2/import`` failed with status 413: (unknown cause)

Turns out a rogue f string was still hidden somewhere, it works now !

Glad it works now! Fix for underlying problem coming soon Fix documents broken by multi-line f-string formulas on Python 3.12+ by paulfitz · Pull Request #2518 · gristlabs/grist-core · GitHub