{"record":{"id":"9171ee724d48066e","repo":"iOfficeAI/OfficeCLI","slug":"unsupported-command","errorCode":"unsupported_command","errorMessage":"Format-handler plugin '{_plugin.Manifest.Name}' does not implement command '{command}'.","messagePattern":"Format-handler plugin '(.+?)' does not implement command '(.+?)'\\.","errorType":"exception","errorClass":"CliException","httpStatus":null,"severity":"error","filePath":"src/officecli/Core/Plugins/FormatHandlerSession.cs","lineNumber":164,"sourceCode":"    /// <summary>\n    /// Send a request envelope and synchronously wait for the matching reply.\n    /// Throws <see cref=\"CliException\"/> on protocol error, IO failure, or\n    /// plugin-reported error responses.\n    /// </summary>\n    public JsonNode? Send(string msgType, string? command, JsonObject? args = null, JsonObject? props = null)\n    {\n        if (_disposed) throw new ObjectDisposedException(nameof(FormatHandlerSession));\n        if (_broken)\n            throw new CliException(\n                $\"Format-handler session for '{_plugin.Manifest.Name}' is no longer usable (stream was closed earlier).\")\n            { Code = \"plugin_stream_closed\" };\n\n        // Capability gate: short-circuit verbs the plugin already declared it\n        // does not support, avoiding a wasted round-trip and ambiguous errors.\n        if (command is not null && _sessionCaps?.Capabilities?.Commands is { Count: > 0 } cmds\n            && !cmds.Contains(command))\n        {\n            throw new CliException(\n                $\"Format-handler plugin '{_plugin.Manifest.Name}' does not implement command '{command}'.\")\n            { Code = \"unsupported_command\" };\n        }\n\n        var verbForTimeout = command ?? msgType;\n        var idle = _plugin.Manifest.ResolveIdleTimeout(verbForTimeout);\n        return SendRaw(msgType, command, args, props, idle);\n    }\n\n    private JsonNode? SendRaw(string msgType, string? command, JsonObject? args, JsonObject? props, int idleTimeoutSec)\n    {\n        if (_stdinWriter is null || _stdoutReader is null)\n            throw new InvalidOperationException(\"Session not started.\");\n\n        var request = new JsonObject\n        {\n            [\"protocol\"] = 1,\n            [\"msg_type\"] = msgType,","sourceCodeStart":146,"sourceCodeEnd":182,"githubUrl":"https://github.com/iOfficeAI/OfficeCLI/blob/1ced45e900782c5083ed550ddf328ee974e425e7/src/officecli/Core/Plugins/FormatHandlerSession.cs#L146-L182","documentation":"CliException (code 'unsupported_command') thrown by Send's capability gate: the plugin's declared Commands list (non-empty) does not contain the requested command. This short-circuits before any wire round-trip, avoiding a wasted request and ambiguous late errors.","triggerScenarios":"Calling a FormatHandlerProxy method whose underlying Send passes a command not in _sessionCaps.Capabilities.Commands. Only fires when the plugin declared a non-empty Commands list (silent absence of a declaration means no gate).","commonSituations":"Host feature targets a command the plugin version omits; plugin manifest's commands list out of date; using a minimal plugin that declares only a subset (e.g. view-only) for a richer operation.","solutions":["Upgrade the plugin to a version that implements the command.","Switch to a plugin whose declared commands include the one you need (`officecli plugins list`).","Update the plugin manifest's commands list if the command is actually implemented but undeclared."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"var cmds = session.Capabilities?.Capabilities?.Commands;\nif (cmds is { Count: > 0 } && !cmds.Contains(command))\n    throw new InvalidOperationException($\"Plugin does not implement '{command}'.\");","typeGuard":"static bool PluginSupports(FormatHandlerSession s, string command) =>\n    s.Capabilities?.Capabilities?.Commands is not { Count: > 0 } cmds || cmds.Contains(command);","tryCatchPattern":"try { session.Send(\"command\", command, args); }\ncatch (CliException ex) when (ex.Code == \"unsupported_command\")\n{ /* pick a plugin whose declared commands include 'command' */ }","preventionTips":["Gate command calls on the declared Commands capability before sending.","Choose plugins whose declared commands cover your feature surface.","Keep the manifest commands list in sync with what the plugin implements."],"tags":["plugins","format-handler","capabilities","command","cli-exception"],"backgroundTag":null,"analyzedSha":"1ced45e900782c5083ed550ddf328ee974e425e7","analyzedAt":"2026-08-13T13:01:07.193Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}