{"record":{"id":"8d45a2ae09121792","repo":"Kuberwastaken/claurst","slug":"rmcp-get-prompt-failed","errorCode":null,"errorMessage":"rmcp get_prompt '{}' failed: {}","messagePattern":"rmcp get_prompt '(.+?)' failed: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src-rust/crates/mcp/src/rmcp_backend.rs","lineNumber":578,"sourceCode":"\n    async fn get_prompt(\n        &self,\n        name: &str,\n        arguments: Option<HashMap<String, String>>,\n    ) -> anyhow::Result<GetPromptResult> {\n        let mut params = rmcp_model::GetPromptRequestParams::new(name.to_string());\n        if let Some(arguments) = arguments {\n            let args = arguments\n                .into_iter()\n                .map(|(key, value)| (key, Value::String(value)))\n                .collect();\n            params = params.with_arguments(args);\n        }\n        let result = self\n            .peer\n            .get_prompt(params)\n            .await\n            .map_err(|e| anyhow::anyhow!(\"rmcp get_prompt '{}' failed: {}\", name, e))?;\n        Ok(convert_get_prompt_result(result))\n    }\n\n    async fn subscribe_resource(&self, uri: &str) -> anyhow::Result<()> {\n        self.peer\n            .subscribe(rmcp_model::SubscribeRequestParams::new(uri.to_string()))\n            .await\n            .map_err(|e| anyhow::anyhow!(\"rmcp subscribe '{}' failed: {}\", uri, e))\n    }\n\n    async fn unsubscribe_resource(&self, uri: &str) -> anyhow::Result<()> {\n        self.peer\n            .unsubscribe(rmcp_model::UnsubscribeRequestParams::new(uri.to_string()))\n            .await\n            .map_err(|e| anyhow::anyhow!(\"rmcp unsubscribe '{}' failed: {}\", uri, e))\n    }\n\n    fn subscribe_to_notifications(&self) -> BoxStream<'static, anyhow::Result<Value>> {","sourceCodeStart":560,"sourceCodeEnd":596,"githubUrl":"https://github.com/Kuberwastaken/claurst/blob/b0637c97ec34144387cbf2f74f65df6d16a6cef1/src-rust/crates/mcp/src/rmcp_backend.rs#L560-L596","documentation":"Raised in `RmcpClientBackend::get_prompt` when the rmcp peer's `get_prompt(params)` future fails after building a `GetPromptRequestParams` (with optional string arguments) for the named prompt. This wraps transport failures and JSON-RPC error responses from the server's `prompts/get` handler. It does not cover prompt rendering failures reported inside a successful result — only failure of the protocol call itself.","triggerScenarios":"Calling `get_prompt(name, arguments)` when the request fails at protocol level: unknown prompt name (server returns 'unknown prompt'), missing required prompt arguments, argument values failing server validation, session closed mid-call, transport error, or timeout while the server renders the prompt.","commonSituations":"Using a slash command whose prompt was removed or renamed after a server update; invoking a prompt without its required arguments; wrong argument names that don't match the prompt's declared arguments; server-side template rendering error surfaced as a JSON-RPC error.","solutions":["Call list_prompts first and confirm the prompt name exists and matches exactly.","Check the prompt's declared arguments and supply every required one with the correct name.","Read the inner error text to distinguish 'unknown prompt' from validation and transport errors.","Reconnect the session and retry if the transport was closed."],"exampleFix":"// before: invoking by remembered name/args\nlet prompt = backend.get_prompt(\"review_code\", None).await?;\n// after: verify name and required arguments first\nlet prompts = backend.list_prompts().await?;\nlet p = prompts.iter().find(|p| p.name == \"review_code\")\n    .ok_or_else(|| anyhow::anyhow!(\"prompt review_code not available\"))?;\nlet mut args = HashMap::new();\nfor req in &p.required_arguments { args.insert(req.clone(), String::new()); }\nlet prompt = backend.get_prompt(\"review_code\", Some(args)).await?;","handlingStrategy":"validation","validationCode":"fn validate_prompt_args(prompts: &[McpPrompt], name: &str, args: &HashMap<String, String>) -> anyhow::Result<()> {\n    let prompt = prompts.iter().find(|p| p.name == name)\n        .ok_or_else(|| anyhow::anyhow!(\"prompt '{name}' not found\"))?;\n    for req in &prompt.required_arguments {\n        anyhow::ensure!(args.contains_key(req), \"prompt '{name}' requires argument '{req}'\");\n    }\n    Ok(())\n}","typeGuard":null,"tryCatchPattern":"match backend.get_prompt(name, args).await {\n    Ok(p) => p,\n    Err(e) if e.to_string().contains(\"unknown prompt\") => {\n        eprintln!(\"prompt '{name}' not offered; refresh prompt list\");\n        GetPromptResult::default()\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["Discover prompt names via list_prompts instead of hardcoding them.","Supply every required argument with the exact declared name and string values.","Refresh the prompt list after server updates; prompts are commonly renamed or removed.","Treat JSON-RPC validation errors as a client bug — fix the arguments rather than retrying."],"tags":["mcp","jsonrpc","prompts","rpc","arguments"],"backgroundTag":"api-request-failed","analyzedSha":"b0637c97ec34144387cbf2f74f65df6d16a6cef1","analyzedAt":"2026-09-10T00:24:58.650Z","contentChangedAt":"2026-09-10T00:24:58.650Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}