[GH-ISSUE #675] Error: no such function: JSON_VALID during archivebox init when SQLite JSON extension isn't present on Windows #1936

Closed
opened 2026-03-01 17:55:07 +03:00 by kerem · 1 comment
Owner

Originally created by @Leontking on GitHub (Mar 27, 2021).
Original GitHub issue: https://github.com/ArchiveBox/ArchiveBox/issues/675

E:\ArchiveBox>archivebox init
←[01;30m[i] [2021-03-27 03:50:10] ArchiveBox v0.5.4: archivebox init←[00;00m
←[01;30m    > E:\ArchiveBox←[00;00m

←[01;32m[*] Updating existing ArchiveBox collection in this folder...←[00;00m
    E:\ArchiveBox
←[01;32m------------------------------------------------------------------←[00;00m

←[01;32m[*] Verifying archive folder structure...←[00;00m
    √ E:\ArchiveBox\sources
    √ E:\ArchiveBox\archive
    √ E:\ArchiveBox\logs
    √ E:\ArchiveBox\ArchiveBox.conf

←[01;32m[*] Verifying main SQL index and running migrations...←[00;00m
    √ E:\ArchiveBox\index.sqlite3

Traceback (most recent call last):
  File "d:\python\lib\site-packages\django\db\backends\utils.py", line 82, in _execute
    return self.cursor.execute(sql)
  File "d:\python\lib\site-packages\django\db\backends\sqlite3\base.py", line 411, in execute
    return Database.Cursor.execute(self, query)
sqlite3.OperationalError: no such function: JSON_VALID

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "d:\python\lib\runpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "d:\python\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "D:\Python\Scripts\archivebox.exe\__main__.py", line 7, in <module>
    from .cli import main
  File "d:\python\lib\site-packages\archivebox\cli\__init__.py", line 129, in main
    run_subcommand(
  File "d:\python\lib\site-packages\archivebox\cli\__init__.py", line 69, in run_subcommand
    module.main(args=subcommand_args, stdin=stdin, pwd=pwd)    # type: ignore
  File "d:\python\lib\site-packages\archivebox\cli\archivebox_init.py", line 33, in main
    init(
  File "d:\python\lib\site-packages\archivebox\util.py", line 112, in typechecked_function
    return func(*args, **kwargs)
  File "d:\python\lib\site-packages\archivebox\main.py", line 323, in init
    for migration_line in apply_migrations(out_dir):
  File "d:\python\lib\site-packages\archivebox\util.py", line 112, in typechecked_function
    return func(*args, **kwargs)
  File "d:\python\lib\site-packages\archivebox\index\sql.py", line 98, in apply_migrations
    call_command("migrate", interactive=False, stdout=out)
  File "d:\python\lib\site-packages\django\core\management\__init__.py", line 168, in call_command
    return command.execute(*args, **defaults)
  File "d:\python\lib\site-packages\django\core\management\base.py", line 371, in execute
    output = self.handle(*args, **options)
  File "d:\python\lib\site-packages\django\core\management\base.py", line 85, in wrapped
    res = handle_func(*args, **kwargs)
  File "d:\python\lib\site-packages\django\core\management\commands\migrate.py", line 243, in handle
    post_migrate_state = executor.migrate(
  File "d:\python\lib\site-packages\django\db\migrations\executor.py", line 117, in migrate
    state = self._migrate_all_forwards(state, plan, full_plan, fake=fake, fake_initial=fake_initial)
  File "d:\python\lib\site-packages\django\db\migrations\executor.py", line 147, in _migrate_all_forwards
    state = self.apply_migration(state, migration, fake=fake, fake_initial=fake_initial)
  File "d:\python\lib\site-packages\django\db\migrations\executor.py", line 227, in apply_migration
    state = migration.apply(state, schema_editor)
  File "d:\python\lib\site-packages\django\db\migrations\migration.py", line 124, in apply
    operation.database_forwards(self.app_label, schema_editor, old_state, project_state)
  File "d:\python\lib\site-packages\django\db\migrations\operations\models.py", line 92, in database_forwards
    schema_editor.create_model(model)
  File "d:\python\lib\site-packages\django\db\backends\base\schema.py", line 324, in create_model
    self.execute(sql, params or None)
  File "d:\python\lib\site-packages\django\db\backends\base\schema.py", line 142, in execute
    cursor.execute(sql, params)
  File "d:\python\lib\site-packages\django\db\backends\utils.py", line 66, in execute
    return self._execute_with_wrappers(sql, params, many=False, executor=self._execute)
  File "d:\python\lib\site-packages\django\db\backends\utils.py", line 75, in _execute_with_wrappers
    return executor(sql, params, many, context)
  File "d:\python\lib\site-packages\django\db\backends\utils.py", line 84, in _execute
    return self.cursor.execute(sql, params)
  File "d:\python\lib\site-packages\django\db\utils.py", line 90, in __exit__
    raise dj_exc_value.with_traceback(traceback) from exc_value
  File "d:\python\lib\site-packages\django\db\backends\utils.py", line 82, in _execute
    return self.cursor.execute(sql)
  File "d:\python\lib\site-packages\django\db\backends\sqlite3\base.py", line 411, in execute
    return Database.Cursor.execute(self, query)
django.db.utils.OperationalError: no such function: JSON_VALID
Originally created by @Leontking on GitHub (Mar 27, 2021). Original GitHub issue: https://github.com/ArchiveBox/ArchiveBox/issues/675 ```batch E:\ArchiveBox>archivebox init ←[01;30m[i] [2021-03-27 03:50:10] ArchiveBox v0.5.4: archivebox init←[00;00m ←[01;30m > E:\ArchiveBox←[00;00m ←[01;32m[*] Updating existing ArchiveBox collection in this folder...←[00;00m E:\ArchiveBox ←[01;32m------------------------------------------------------------------←[00;00m ←[01;32m[*] Verifying archive folder structure...←[00;00m √ E:\ArchiveBox\sources √ E:\ArchiveBox\archive √ E:\ArchiveBox\logs √ E:\ArchiveBox\ArchiveBox.conf ←[01;32m[*] Verifying main SQL index and running migrations...←[00;00m √ E:\ArchiveBox\index.sqlite3 Traceback (most recent call last): File "d:\python\lib\site-packages\django\db\backends\utils.py", line 82, in _execute return self.cursor.execute(sql) File "d:\python\lib\site-packages\django\db\backends\sqlite3\base.py", line 411, in execute return Database.Cursor.execute(self, query) sqlite3.OperationalError: no such function: JSON_VALID The above exception was the direct cause of the following exception: Traceback (most recent call last): File "d:\python\lib\runpy.py", line 194, in _run_module_as_main return _run_code(code, main_globals, None, File "d:\python\lib\runpy.py", line 87, in _run_code exec(code, run_globals) File "D:\Python\Scripts\archivebox.exe\__main__.py", line 7, in <module> from .cli import main File "d:\python\lib\site-packages\archivebox\cli\__init__.py", line 129, in main run_subcommand( File "d:\python\lib\site-packages\archivebox\cli\__init__.py", line 69, in run_subcommand module.main(args=subcommand_args, stdin=stdin, pwd=pwd) # type: ignore File "d:\python\lib\site-packages\archivebox\cli\archivebox_init.py", line 33, in main init( File "d:\python\lib\site-packages\archivebox\util.py", line 112, in typechecked_function return func(*args, **kwargs) File "d:\python\lib\site-packages\archivebox\main.py", line 323, in init for migration_line in apply_migrations(out_dir): File "d:\python\lib\site-packages\archivebox\util.py", line 112, in typechecked_function return func(*args, **kwargs) File "d:\python\lib\site-packages\archivebox\index\sql.py", line 98, in apply_migrations call_command("migrate", interactive=False, stdout=out) File "d:\python\lib\site-packages\django\core\management\__init__.py", line 168, in call_command return command.execute(*args, **defaults) File "d:\python\lib\site-packages\django\core\management\base.py", line 371, in execute output = self.handle(*args, **options) File "d:\python\lib\site-packages\django\core\management\base.py", line 85, in wrapped res = handle_func(*args, **kwargs) File "d:\python\lib\site-packages\django\core\management\commands\migrate.py", line 243, in handle post_migrate_state = executor.migrate( File "d:\python\lib\site-packages\django\db\migrations\executor.py", line 117, in migrate state = self._migrate_all_forwards(state, plan, full_plan, fake=fake, fake_initial=fake_initial) File "d:\python\lib\site-packages\django\db\migrations\executor.py", line 147, in _migrate_all_forwards state = self.apply_migration(state, migration, fake=fake, fake_initial=fake_initial) File "d:\python\lib\site-packages\django\db\migrations\executor.py", line 227, in apply_migration state = migration.apply(state, schema_editor) File "d:\python\lib\site-packages\django\db\migrations\migration.py", line 124, in apply operation.database_forwards(self.app_label, schema_editor, old_state, project_state) File "d:\python\lib\site-packages\django\db\migrations\operations\models.py", line 92, in database_forwards schema_editor.create_model(model) File "d:\python\lib\site-packages\django\db\backends\base\schema.py", line 324, in create_model self.execute(sql, params or None) File "d:\python\lib\site-packages\django\db\backends\base\schema.py", line 142, in execute cursor.execute(sql, params) File "d:\python\lib\site-packages\django\db\backends\utils.py", line 66, in execute return self._execute_with_wrappers(sql, params, many=False, executor=self._execute) File "d:\python\lib\site-packages\django\db\backends\utils.py", line 75, in _execute_with_wrappers return executor(sql, params, many, context) File "d:\python\lib\site-packages\django\db\backends\utils.py", line 84, in _execute return self.cursor.execute(sql, params) File "d:\python\lib\site-packages\django\db\utils.py", line 90, in __exit__ raise dj_exc_value.with_traceback(traceback) from exc_value File "d:\python\lib\site-packages\django\db\backends\utils.py", line 82, in _execute return self.cursor.execute(sql) File "d:\python\lib\site-packages\django\db\backends\sqlite3\base.py", line 411, in execute return Database.Cursor.execute(self, query) django.db.utils.OperationalError: no such function: JSON_VALID ```
kerem 2026-03-01 17:55:07 +03:00
Author
Owner

@pirate commented on GitHub (Mar 27, 2021):

Your SQLite3 install needs to have the JSON extension enabled: https://www.sqlite.org/json1.html

You should either install Python 3.9, or enable the JSON extension manually by following the instructions here: https://code.djangoproject.com/wiki/JSON1Extension#windows

I've added a more explicit check+warning in v0.6, but this is an issue that users need to fix on their own systems, not a bug in archivebox: 185d2f9

<!-- gh-comment-id:808645588 --> @pirate commented on GitHub (Mar 27, 2021): Your SQLite3 install needs to have the JSON extension enabled: https://www.sqlite.org/json1.html You should either install Python 3.9, or enable the JSON extension manually by following the instructions here: https://code.djangoproject.com/wiki/JSON1Extension#windows I've added a more explicit check+warning in v0.6, but this is an issue that users need to fix on their own systems, not a bug in archivebox: 185d2f9
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/ArchiveBox#1936
No description provided.