{"record":{"id":"19f304909958a169","repo":"siyuan-note/siyuan","slug":"capability-is-disabled-or-no-longer-available-s","errorCode":null,"errorMessage":"capability is disabled or no longer available: %s","messagePattern":"capability is disabled or no longer available: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"kernel/agent/tools.go","lineNumber":61,"sourceCode":"\t}\n\tif t.ContextHandler == nil && t.Handler == nil {\n\t\treturn nil, nil, fmt.Errorf(\"tool handler unavailable: %s\", toolName)\n\t}\n\tif ctx.Err() != nil {\n\t\treturn nil, nil, fmt.Errorf(\"tool execution was cancelled before it started\")\n\t}\n\tif err := validator.ValidateInputContext(ctx, args); err != nil {\n\t\treturn nil, nil, fmt.Errorf(\"invalid tool arguments: %w\", err)\n\t}\n\treturn t, validator, nil\n}\n\nfunc validateCapabilityCall(ctx context.Context, registration *capabilityRegistration, args map[string]any) error {\n\tif registration == nil {\n\t\treturn fmt.Errorf(\"capability was not exposed in this model round\")\n\t}\n\tif !capabilityStillExecutable(registration, args) {\n\t\treturn fmt.Errorf(\"capability is disabled or no longer available: %s\", registration.ID)\n\t}\n\tif ctx.Err() != nil {\n\t\treturn fmt.Errorf(\"capability execution was cancelled before it started\")\n\t}\n\tif registration.Validator == nil {\n\t\treturn fmt.Errorf(\"capability validator unavailable: %s\", registration.ID)\n\t}\n\tif err := registration.Validator.ValidateInputContext(ctx, args); err != nil {\n\t\treturn fmt.Errorf(\"invalid capability arguments: %w\", err)\n\t}\n\tif !registration.isBrowser() &&\n\t\t(registration.Tool == nil || registration.Tool.ContextHandler == nil && registration.Tool.Handler == nil) {\n\t\treturn fmt.Errorf(\"capability handler unavailable: %s\", registration.ID)\n\t}\n\treturn nil\n}\n\n// executeTool 执行单次工具调用。","sourceCodeStart":43,"sourceCodeEnd":79,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/afa823b6b4e4f183511e0bc0a3be93caa94c7c97/kernel/agent/tools.go#L43-L79","documentation":"validateCapabilityCall checks capabilityStillExecutable (kernel/agent/capability.go:351-369): the capability's owner must still be available (connected MCP server, enabled plugin, matching browser-capability generation) and the Agent CapabilityPolicy must still allow the ID, and for non-browser tools the current registry entry must be identical to the registered one. If any check fails, the call is rejected with 'capability is disabled or no longer available: <capabilityID>' and never reaches the handler.","triggerScenarios":"Tool call executed after its owner disappeared mid-session: MCP server disconnected between exposure and execution, plugin disabled/uninstalled, browser window that declared a frontend capability closed or reloaded (generation mismatch), or the admin changed the Agent capability policy (Settings - AI - Agent capability restrictions) to deny that tool. Also fires when the tool registry was rebuilt with a different Tool pointer.","commonSituations":"User revokes a plugin or disconnects an MCP server while the agent is mid-turn; capability policy tightened between rounds; frontend reload during a browser-capability turn; stale sessions resumed after a config change.","solutions":["Re-enable the plugin / reconnect the MCP server (or reload the frontend that owns the capability), then start a new round so capabilities are re-exposed","Check Settings - AI and confirm the capability is not denied by the Agent capability policy","Do not blind-retry inside the same round — the capability set is fixed per round; a new turn re-registers it","If the tool must survive disconnects, prefer kernel-native tools over per-connection MCP/browser ones"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":"// Before executing, verify the owner is still connected / policy still allows\n// kernel-side: capabilityStillExecutable(registration, args)\n// client-side: check MCP server status + plugin enabled state for that capability","typeGuard":"null","tryCatchPattern":"null","preventionTips":["Keep MCP servers and plugins connected for the whole turn, or expect mid-turn revocation","Re-check capability policy after tightening Settings - AI restrictions","Prefer kernel-native tools for operations that must survive disconnects"],"tags":["agent","capability","mcp","plugin","revoked"],"backgroundTag":"capability-revoked-mid-session","analyzedSha":"afa823b6b4e4f183511e0bc0a3be93caa94c7c97","analyzedAt":"2026-08-18T17:04:10.865Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T05:18:18.240Z"}