Skip to content

[Bug]: VersionedDatabaseTaskStore get() and delete() fail with "no such table" when initialize() was not called #1356

Closed

Description

@cchinchilla-dev

What happened?

VersionedDatabaseTaskStore (src/a2a/server/cluster/database_task_store.py, added in #1281) creates its tables lazily, like DatabaseTaskStore: save() calls self._db._ensure_initialized() and then self._ensure_cluster_tables() before touching the database. get() and delete() only initialize the underlying DatabaseTaskStore, so on that path the task_versions table is never created.

If the store is used without calling initialize() first and the first operation is a get() or a delete(), the query on task_versions fails instead of returning None for a missing task:

store = VersionedDatabaseTaskStore(engine=create_async_engine('sqlite+aiosqlite:///:memory:'))

await store.get('missing', ServerCallContext())
# sqlalchemy.exc.OperationalError: (sqlite3.OperationalError) no such table: task_versions

await store.delete('missing', ServerCallContext())
# sqlalchemy.exc.OperationalError: (sqlite3.OperationalError) no such table: task_versions

The cluster sample and the existing tests call initialize() explicitly, so this only shows up when relying on the lazy initialization that save() and DatabaseTaskStore already provide.

Suggested fix: call self._ensure_cluster_tables() in get() and delete() after initializing the underlying store, as save() does.

I have a fix ready and I'm opening a PR alongside this issue.

Code of Conduct

  • I agree to follow this project's Code of Conduct

Activity

  1. added
    component: serverIssues related to frameworks for agent execution, HTTP/event handling, database persistence logic.
    on Oct 21, 2026
  2. added theissue type on Oct 21, 2026
  3. rohityan commented on Oct 21, 2026

    @rohityan

    Hi @cchinchilla-dev , thanks for reporting this and I was able to reproduce the issue.

    Thanks for contributing towards a fix with #1357. The approach looks correct. Assigning this issue to you till the PR gets reviewed.

    Till then as a workaround you can explicitly call await store.initialize() directly after instantiation to eagerly provision all tables before any read or delete calls.

  4. added a commit that references this issue on Oct 27, 2026
    4e133b7
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

component: serverIssues related to frameworks for agent execution, HTTP/event handling, database persistence logic.status:awaiting response

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions