langgenius/dify · error · AgentConfigServiceError

config_version_not_found

config_version_not_found

Error message

agent config version was not found

What it means

Raised as AgentConfigServiceError (code=config_version_not_found, HTTP 404) from the except branch of _resolve_console_version: AgentComposerService.load_agent_composer / load_agent_app_build_draft raised AgentVersionNotFoundError. It means the Agent itself (or the requested version) could not be found while resolving the config version for the inspector/asset endpoints.

Source

Thrown at api/controllers/console/app/agent_config_inspector.py:314

                agent_id=agent_id,
                account_id=account_id,
            )
            draft = state.get("draft") or {}
            draft_id = draft.get("id")
            if isinstance(draft_id, str) and draft_id:
                return draft_id, AgentConfigVersionKind.BUILD_DRAFT
        else:
            state = AgentComposerService.load_agent_composer(session=session, tenant_id=tenant_id, agent_id=agent_id)
            draft = state.get("draft") or {}
            draft_id = draft.get("id")
            if isinstance(draft_id, str) and draft_id:
                # load_agent_composer creates the normal draft on first access.
                # Config asset services use their own SQLAlchemy session, so the
                # draft must be visible before we hand its id across that boundary.
                session.commit()
                return draft_id, AgentConfigVersionKind.DRAFT
    except AgentVersionNotFoundError as exc:
        raise AgentConfigServiceError(
            "config_version_not_found",
            "agent config version was not found",
            status_code=404,
        ) from exc
    raise AgentConfigServiceError(
        "config_version_not_found",
        "agent config version was not found",
        status_code=404,
    )


def _resolve_target(
    *,
    session: Session,
    tenant_id: str,
    agent_id: str,
    account_id: str,
    version_id: str | None,

View on GitHub (pinned to ef8544b173)

Solutions

  1. Reload the Agent in the console to confirm it still exists and is in an ACTIVE/visible state.
  2. Ensure version_id (if provided) belongs to the given Agent and tenant.
  3. Retry after the in-flight publish/delete completes; if the Agent was deleted intentionally, navigate away.
  4. Inspect AgentVersionNotFoundError logs for the underlying missing entity (Agent vs version).
Defensive patterns

Strategy: try-catch

Try / catch

from services.errors.agent_config import AgentConfigServiceError

try:
    manifest = fetch_config_manifest(agent_id=agent_id)
except AgentConfigServiceError as exc:
    if exc.code == 'config_version_not_found':
        # Agent/version removed mid-flight: reload Agent and retry
        reload_agent()
    raise

Prevention

When it happens

Trigger: Calling an agent-config-inspector endpoint (manifest, skill list, file list, upload) when the Agent version lookup inside the composer service fails — e.g. the Agent was deleted between resolving the route target and loading composer state, or the version_id/draft_type combo points to a non-existent version.

Common situations: Agent deleted while the config inspector view is open; referencing a draft_type or version from a different Agent; cross-tenant Agent id; concurrency where a publish/delete races the inspector call.

Related errors


AI-assisted analysis of langgenius/dify@ef8544b173 (2026-08-12). Data as JSON: /api/errors/1e2529e50025855c. Report an issue: GitHub.