{"record":{"id":"1478b0a34200d2a4","repo":"neoclide/coc.nvim","slug":"resource-not-found-uri","errorCode":null,"errorMessage":"Resource not found: ${uri}","messagePattern":"Resource not found: (.+?)","errorType":"error_code","errorClass":"ResourceNotFoundError","httpStatus":null,"severity":"error","filePath":"src/mcp/resources.ts","lineNumber":115,"sourceCode":"            id: stat.id,\n            state: stat.state,\n            languageIds: stat.languageIds,\n            capabilities: init?.capabilities ?? null\n          }\n        })\n        return { contents: [{ uri, mimeType: 'application/json', text: JSON.stringify(stats, null, 2) }] }\n      }\n      case 'coc://workspace': {\n        let info = {\n          version: workspace.version,\n          cwd: workspace.cwd || process.cwd(),\n          root: workspace.root || process.cwd(),\n          folders: workspace.folderPaths\n        }\n        return { contents: [{ uri, mimeType: 'application/json', text: JSON.stringify(info, null, 2) }] }\n      }\n      default:\n        throw new ResourceNotFoundError(`Resource not found: ${uri}`)\n    }\n  }\n\n  public dispose(): void {\n    // nothing to dispose\n  }\n}\n","sourceCodeStart":97,"sourceCodeEnd":123,"githubUrl":"https://github.com/neoclide/coc.nvim/blob/50e974d9692461a69147d5cab146a8d3e439abe4/src/mcp/resources.ts#L97-L123","documentation":"The resources `read` method only handles known URI shapes: `coc://document/...` plus a fixed switch of built-in URIs (diagnostics, workspace info, etc.). Any other URI reaches the `default` branch and throws `ResourceNotFoundError`.","triggerScenarios":"Calling `resources.read(uri)` with a URI that is not a document URI and not one of the built-in cases, e.g. a misspelled scheme ('coc://diagnostic'), an old/renamed URI, or a resource advertised by a different server.","commonSituations":"MCP client cached resource URIs from a previous version where a builtin was renamed; hand-typed URI with a typo; client assumes a resource exists that this coc MCP server never offered.","solutions":["Check the exact URI string for typos in scheme or path","Call resources/list to see the URIs this server actually supports","Update the client to the current builtin URIs if it was written against an older version"],"exampleFix":"// before\nawait read('coc://diagnostic') // singular, unsupported\n// after\nawait read('coc://diagnostics')","handlingStrategy":"validation","validationCode":"const KNOWN = /^coc:\\/\\/document\\//\nconst BUILTINS = ['coc://diagnostics', 'coc://workspace']\nfunction isReadable(uri: string): boolean {\n  return KNOWN.test(uri) || BUILTINS.includes(uri)\n}\nif (!isReadable(uri)) throw new Error(`URI not supported by coc MCP: ${uri}`)","typeGuard":null,"tryCatchPattern":"try {\n  const res = await resources.read(uri)\n} catch (e) {\n  if (/Resource not found:/.test(e.message)) {\n    logger.warn(`Unsupported resource '${uri}' — refresh resources/list`)\n  } else throw e\n}","preventionTips":["Only read URIs obtained from resources/list","Keep builtin URI strings in constants to avoid typos","Update clients when upgrading coc.nvim if builtin URIs changed"],"tags":["mcp","resource-not-found","uri"],"backgroundTag":"resource-not-found","analyzedSha":"50e974d9692461a69147d5cab146a8d3e439abe4","analyzedAt":"2026-08-31T11:17:23.966Z","schemaVersion":2},"datasetVersion":"2026-09-01T08:17:40.651Z"}