abhigyanpatwari/GitNexus · error

Unknown group resource path in URI: ${uri}

Error message

Unknown group resource path in URI: ${uri}

What it means

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.

Source

Thrown at gitnexus/src/mcp/resources.ts:189

  }

  if (u.protocol !== 'gitnexus:') {
    throw new Error(`Unknown resource URI: ${uri}`);
  }

  if (u.hostname === 'group') {
    const segments = u.pathname
      .replace(/^\/+|\/+$/g, '')
      .split('/')
      .filter(Boolean);
    if (segments.length < 2) {
      throw new Error(
        `Invalid group resource URI (expected gitnexus://group/{name}/contracts or .../status): ${uri}`,
      );
    }
    const tail = segments[segments.length - 1]!;
    if (tail !== 'contracts' && tail !== 'status') {
      throw new Error(`Unknown group resource path in URI: ${uri}`);
    }
    const groupName = segments
      .slice(0, -1)
      .map((s) => decodeURIComponent(s))
      .join('/');
    if (!groupName) {
      throw new Error(`Invalid group resource URI (empty group name): ${uri}`);
    }
    if (tail === 'status') {
      return { kind: 'group', groupName, resourceType: 'status' };
    }
    const contractsFilter: GroupContractsResourceFilter = {};
    const type = u.searchParams.get('type');
    if (type && type.trim()) contractsFilter.type = type.trim();
    const repo = u.searchParams.get('repo');
    if (repo && repo.trim()) contractsFilter.repo = repo.trim();
    if (u.searchParams.has('unmatchedOnly')) {
      const coerced = parseUnmatchedOnlyParam(u.searchParams.get('unmatchedOnly'));

View on GitHub (pinned to 0d1aed942f)

Solutions

  1. Use only the two supported leaves: gitnexus://group/{name}/contracts or gitnexus://group/{name}/status.
  2. For per-repo data (context, clusters, processes), use the repo resource form gitnexus://repo/{name}/{resource}.
  3. Enumerate advertised resource templates from the server instead of constructing group paths by analogy.

Example fix

# before
read_resource 'gitnexus://group/org/context'

# after
read_resource 'gitnexus://repo/frontend/context'
Defensive patterns

Strategy: validation

Validate before calling

const GROUP_LEAVES = new Set(['contracts', 'status']);
function buildGroupUri(group: string, leaf: string): string {
  if (!GROUP_LEAVES.has(leaf)) throw new RangeError(`Unsupported group resource '${leaf}' — use contracts or status`);
  return `gitnexus://group/${encodeURIComponent(group)}/${leaf}`;
}

Type guard

const isSupportedGroupLeaf = (leaf: string): leaf is 'contracts' | 'status' =>
  leaf === 'contracts' || leaf === 'status';

Try / catch

try {
  await client.readResource({ uri });
} catch (e) {
  if (e instanceof Error && /Unknown group resource path/.test(e.message)) {
    throw new Error(`Only contracts and status leaves exist for groups — got ${uri}`);
  }
  throw e;
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of abhigyanpatwari/GitNexus@0d1aed942f (2026-08-20). Data as JSON: /api/errors/475b0363c4c34c28. Report an issue: GitHub.