{"record":{"id":"1e2529e50025855c","repo":"langgenius/dify","slug":"config-version-not-found","errorCode":"config_version_not_found","errorMessage":"agent config version was not found","messagePattern":"agent config version was not found","errorType":"error_code","errorClass":"AgentConfigServiceError","httpStatus":404,"severity":"error","filePath":"api/controllers/console/app/agent_config_inspector.py","lineNumber":314,"sourceCode":"                agent_id=agent_id,\n                account_id=account_id,\n            )\n            draft = state.get(\"draft\") or {}\n            draft_id = draft.get(\"id\")\n            if isinstance(draft_id, str) and draft_id:\n                return draft_id, AgentConfigVersionKind.BUILD_DRAFT\n        else:\n            state = AgentComposerService.load_agent_composer(session=session, tenant_id=tenant_id, agent_id=agent_id)\n            draft = state.get(\"draft\") or {}\n            draft_id = draft.get(\"id\")\n            if isinstance(draft_id, str) and draft_id:\n                # load_agent_composer creates the normal draft on first access.\n                # Config asset services use their own SQLAlchemy session, so the\n                # draft must be visible before we hand its id across that boundary.\n                session.commit()\n                return draft_id, AgentConfigVersionKind.DRAFT\n    except AgentVersionNotFoundError as exc:\n        raise AgentConfigServiceError(\n            \"config_version_not_found\",\n            \"agent config version was not found\",\n            status_code=404,\n        ) from exc\n    raise AgentConfigServiceError(\n        \"config_version_not_found\",\n        \"agent config version was not found\",\n        status_code=404,\n    )\n\n\ndef _resolve_target(\n    *,\n    session: Session,\n    tenant_id: str,\n    agent_id: str,\n    account_id: str,\n    version_id: str | None,","sourceCodeStart":296,"sourceCodeEnd":332,"githubUrl":"https://github.com/langgenius/dify/blob/ef8544b173fd6cd7a8e71df2cab576e52bebbfbc/api/controllers/console/app/agent_config_inspector.py#L296-L332","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Reload the Agent in the console to confirm it still exists and is in an ACTIVE/visible state.","Ensure version_id (if provided) belongs to the given Agent and tenant.","Retry after the in-flight publish/delete completes; if the Agent was deleted intentionally, navigate away.","Inspect AgentVersionNotFoundError logs for the underlying missing entity (Agent vs version)."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"from services.errors.agent_config import AgentConfigServiceError\n\ntry:\n    manifest = fetch_config_manifest(agent_id=agent_id)\nexcept AgentConfigServiceError as exc:\n    if exc.code == 'config_version_not_found':\n        # Agent/version removed mid-flight: reload Agent and retry\n        reload_agent()\n    raise","preventionTips":["Pass an explicit version_id (published snapshot) to bypass composer draft resolution.","Avoid racing publish/delete with config-inspector reads.","Reload the Agent in the console after deletion/restore before re-opening the inspector."],"tags":["agent-config","config-version","not-found","inspector"],"backgroundTag":null,"analyzedSha":"ef8544b173fd6cd7a8e71df2cab576e52bebbfbc","analyzedAt":"2026-08-12T05:15:17.394Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}