{"record":{"id":"475b0363c4c34c28","repo":"abhigyanpatwari/GitNexus","slug":"unknown-group-resource-path-in-uri-uri","errorCode":null,"errorMessage":"Unknown group resource path in URI: ${uri}","messagePattern":"Unknown group resource path in URI: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"gitnexus/src/mcp/resources.ts","lineNumber":189,"sourceCode":"  }\n\n  if (u.protocol !== 'gitnexus:') {\n    throw new Error(`Unknown resource URI: ${uri}`);\n  }\n\n  if (u.hostname === 'group') {\n    const segments = u.pathname\n      .replace(/^\\/+|\\/+$/g, '')\n      .split('/')\n      .filter(Boolean);\n    if (segments.length < 2) {\n      throw new Error(\n        `Invalid group resource URI (expected gitnexus://group/{name}/contracts or .../status): ${uri}`,\n      );\n    }\n    const tail = segments[segments.length - 1]!;\n    if (tail !== 'contracts' && tail !== 'status') {\n      throw new Error(`Unknown group resource path in URI: ${uri}`);\n    }\n    const groupName = segments\n      .slice(0, -1)\n      .map((s) => decodeURIComponent(s))\n      .join('/');\n    if (!groupName) {\n      throw new Error(`Invalid group resource URI (empty group name): ${uri}`);\n    }\n    if (tail === 'status') {\n      return { kind: 'group', groupName, resourceType: 'status' };\n    }\n    const contractsFilter: GroupContractsResourceFilter = {};\n    const type = u.searchParams.get('type');\n    if (type && type.trim()) contractsFilter.type = type.trim();\n    const repo = u.searchParams.get('repo');\n    if (repo && repo.trim()) contractsFilter.repo = repo.trim();\n    if (u.searchParams.has('unmatchedOnly')) {\n      const coerced = parseUnmatchedOnlyParam(u.searchParams.get('unmatchedOnly'));","sourceCodeStart":171,"sourceCodeEnd":207,"githubUrl":"https://github.com/abhigyanpatwari/GitNexus/blob/0d1aed942f0e8b5d3bac27519fff441aceea722d/gitnexus/src/mcp/resources.ts#L171-L207","documentation":"Thrown by parseResourceUri for a gitnexus://group/{name}/... URI whose final path segment is neither 'contracts' nor 'status'. After the two-segment minimum is satisfied, the tail is checked against the only two supported group resource types; any other leaf (wiki, overview, context, etc.) is an unknown group resource path.","triggerScenarios":"Reading 'gitnexus://group/org/wiki', 'gitnexus://group/org/context', or 'gitnexus://group/org/contracts/v2' (tail is 'v2'). Also multi-segment names like 'gitnexus://group/a/b/status' are fine — only the LAST segment is checked — so 'gitnexus://group/a/b/c' throws because tail 'c' is unsupported.","commonSituations":"Users generalize from repo resources (context/clusters/processes) to group URIs and try gitnexus://group/{name}/context. Version-pinned or localized paths ('gitnexus://group/org/contracte') after hand-editing URIs.","solutions":["Use only the two supported leaves: gitnexus://group/{name}/contracts or gitnexus://group/{name}/status.","For per-repo data (context, clusters, processes), use the repo resource form gitnexus://repo/{name}/{resource}.","Enumerate advertised resource templates from the server instead of constructing group paths by analogy."],"exampleFix":"# before\nread_resource 'gitnexus://group/org/context'\n\n# after\nread_resource 'gitnexus://repo/frontend/context'","handlingStrategy":"validation","validationCode":"const GROUP_LEAVES = new Set(['contracts', 'status']);\nfunction buildGroupUri(group: string, leaf: string): string {\n  if (!GROUP_LEAVES.has(leaf)) throw new RangeError(`Unsupported group resource '${leaf}' — use contracts or status`);\n  return `gitnexus://group/${encodeURIComponent(group)}/${leaf}`;\n}","typeGuard":"const isSupportedGroupLeaf = (leaf: string): leaf is 'contracts' | 'status' =>\n  leaf === 'contracts' || leaf === 'status';","tryCatchPattern":"try {\n  await client.readResource({ uri });\n} catch (e) {\n  if (e instanceof Error && /Unknown group resource path/.test(e.message)) {\n    throw new Error(`Only contracts and status leaves exist for groups — got ${uri}`);\n  }\n  throw e;\n}","preventionTips":["Do not invent group leaves by analogy with repo resources (context/clusters/processes do not exist for groups).","Enumerate the server's advertised resource templates instead of constructing paths.","Constrain leaf values in client builders to a literal union 'contracts' | 'status'."],"tags":["mcp","resources","uri-validation","group-routing"],"backgroundTag":"invalid-resource-uri","analyzedSha":"0d1aed942f0e8b5d3bac27519fff441aceea722d","analyzedAt":"2026-08-20T23:29:22.980Z","contentChangedAt":"2026-08-20T23:29:22.980Z","schemaVersion":2},"datasetVersion":"2026-09-08T20:17:18.057Z"}