Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Confusing error if metadata.json contains nested data #2403

@simonw

Description

@simonw

Create an invalid metadata.json file like this:

{"settings": {"trace_debug": 1}}

And start Datasette like so:

datasette -m metadata.json

Datasette appears to start correctly, but when you attempt to load any page you get this error:

Error binding parameter 1 - probably unsupported type

I ran datasette -m metadata.json --get / --pdb and found that the problem was here:

126  	    async def execute_write(self, sql, params=None, block=True):
127  	        def _inner(conn):
128  ->	            return conn.execute(sql, params or [])
129  	
130  	        with trace("sql", database=self.name, sql=sql.strip(), params=params):
131  	            results = await self.execute_write_fn(_inner, block=block)
132  	        return results
133  	
(Pdb) print(sql)
              INSERT INTO metadata_instance(key, value)
                VALUES(?, ?)
                ON CONFLICT(key) DO UPDATE SET value = excluded.value;
(Pdb) params
['settings', {'trace_debug': 1}]

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions