Significant-Gravitas/AutoGPT · error · DatabaseError

Failed to fetch agent details

Error message

Failed to fetch agent details

What it means

DatabaseError raised by get_store_agent_details when the agent row was found but a later step failed — changelog fetching, StoreAgentDetails.from_db conversion, or serialization — or the initial Prisma query itself errored. NotFoundError is re-raised untouched; everything else is wrapped with this generic message and chained cause.

Source

Thrown at autogpt_platform/backend/backend/api/features/store/db.py:345

            )
            changelog_data = [
                store_model.ChangelogEntry(
                    version=str(version.version),
                    changes_summary=version.changesSummary or "No changes recorded",
                    date=version.createdAt,
                )
                for version in changelog_versions
            ]

        logger.debug(f"Found agent details for {username}/{agent_name}")
        details = store_model.StoreAgentDetails.from_db(agent)
        details.changelog = changelog_data
        return details
    except NotFoundError:
        raise
    except Exception as e:
        logger.error(f"Error getting store agent details: {e}")
        raise DatabaseError("Failed to fetch agent details") from e


@overload
async def get_available_graph(
    store_listing_version_id: str, hide_nodes: Literal[False]
) -> GraphModel: ...


@overload
async def get_available_graph(
    store_listing_version_id: str, hide_nodes: Literal[True] = True
) -> GraphModelWithoutNodes: ...


async def get_available_graph(
    store_listing_version_id: str,
    hide_nodes: bool = True,
) -> GraphModelWithoutNodes | GraphModel:

View on GitHub (pinned to 9c8bb5550f)

Solutions

  1. Inspect logs for 'Error getting agent details' to see the chained root cause.
  2. If schema-related, run pending migrations and regenerate the Prisma client.
  3. Data-repair: backfill or fix rows that violate the model's expectations (e.g. null required fields).
  4. Retry once on transient DB errors; escalate if persistent.

Example fix

# before
# migration added NOT NULL column without default; old rows break from_db
# after
ALTER TABLE ... ADD COLUMN ... DEFAULT ...;  -- then regenerate prisma client
Defensive patterns

Strategy: try-catch

Validate before calling

// Callers can't pre-validate DB state; validate only inputs
if (!username || !agent_name) throw new TypeError('username and slug required');

Type guard

function isDatabaseError(e: unknown): e is DatabaseError {
  return e instanceof Error && e.message === 'Failed to fetch agent details';
}

Try / catch

try { return await getStoreAgentDetails(u, slug); }
catch (e) {
  if (isNotFound(e)) return null;
  if (isDatabaseError(e)) { logger.error(e.cause); return retryOnce(getStoreAgentDetails, u, slug); }
  throw e;
}

Prevention

When it happens

Trigger: Loading public agent details while the changelog query (StoreListingVersion find_many) fails, the DB drops mid-request, or the row contains data from_db cannot map (null in a required field after a schema/partial migration).

Common situations: Schema drift where old rows lack newly required columns; DB connection flakiness; Prisma client out of sync with the view definition; changelog rows with unexpected shapes.

Related errors


AI-assisted analysis of Significant-Gravitas/AutoGPT@9c8bb5550f (2026-08-14). Data as JSON: /api/errors/628e9a80267c17e3. Report an issue: GitHub.