{"record":{"id":"61dd25660ec4a351","repo":"abhigyanpatwari/GitNexus","slug":"group-groupname-not-found","errorCode":null,"errorMessage":"Group \"${groupName}\" not found","messagePattern":"Group \"(.+?)\" not found","errorType":"exception","errorClass":"GroupNotFoundError","httpStatus":null,"severity":"warning","filePath":"gitnexus/src/core/group/config-parser.ts","lineNumber":152,"sourceCode":"}\n\nexport class GroupNotFoundError extends Error {\n  constructor(public readonly groupName: string) {\n    super(`Group \"${groupName}\" not found`);\n    this.name = 'GroupNotFoundError';\n  }\n}\n\nexport async function loadGroupConfig(groupDir: string): Promise<GroupConfig> {\n  const fsp = await import('node:fs/promises');\n  const path = await import('node:path');\n  const yamlPath = path.join(groupDir, 'group.yaml');\n  let content: string;\n  try {\n    content = await fsp.readFile(yamlPath, 'utf-8');\n  } catch (err) {\n    if ((err as NodeJS.ErrnoException).code === 'ENOENT') {\n      throw new GroupNotFoundError(path.basename(groupDir));\n    }\n    throw err;\n  }\n  return parseGroupConfig(content);\n}\n","sourceCodeStart":134,"sourceCodeEnd":158,"githubUrl":"https://github.com/abhigyanpatwari/GitNexus/blob/52924ef12c2290ceee4612526a828ec4cdf2047f/gitnexus/src/core/group/config-parser.ts#L134-L158","documentation":"GroupNotFoundError is thrown by loadGroupConfig() when reading <groupDir>/group.yaml fails with ENOENT — the group's manifest file does not exist, so the named group is unknown to gitnexus. The class sets name = 'GroupNotFoundError' precisely so callers (group service, cross-impact, cross-trace) can distinguish 'no such group' from other I/O or parse failures and report it as a user-facing not-found instead of a crash.","triggerScenarios":"Using a @group command, MCP resource, or cross-repo impact/trace call with a group name that has no <group>/group.yaml under the groups root — mistyped name, group never created/synced, group directory deleted, or group.yaml renamed.","commonSituations":"Querying @mygroup before running the group create/sync step; a typo in the group name in an MCP query; the groups root living somewhere else than the tool was pointed at after moving the checkout.","solutions":["List the existing groups (gitnexus group list / the group status MCP resource) and use the exact registered name.","If the group should exist, re-create or re-sync it so <groupDir>/group.yaml is written, and confirm the groups root path configuration.","Check for name typos and case sensitivity — the lookup is by directory basename.","In code, catch GroupNotFoundError via instanceof and degrade to a friendly 'unknown group' message rather than a stack trace."],"exampleFix":"# before\n$ gitnexus impact \"handler\" --repo @mygroup\n# -> GroupNotFoundError: Group \"mygroup\" not found\n\n# after\n$ gitnexus group list\n  my-group\n$ gitnexus impact \"handler\" --repo @my-group","handlingStrategy":"type-guard","validationCode":"import { existsSync } from 'node:fs';\nimport { join } from 'node:path';\n\n// Check before calling group APIs: manifest presence implies the group exists.\nexport function groupExists(groupsRoot: string, name: string): boolean {\n  return existsSync(join(groupsRoot, name, 'group.yaml'));\n}\n\nif (!groupExists(groupsRoot, groupName)) {\n  throw new Error(`unknown group \"${groupName}\" — run the group create/sync step first`);\n}","typeGuard":"import { GroupNotFoundError } from './core/group/config-parser.js';\n\nexport const isGroupNotFoundError = (e: unknown): e is GroupNotFoundError =>\n  e instanceof GroupNotFoundError;\n// Also works across serialization boundaries:\n// e instanceof Error && e.name === 'GroupNotFoundError'","tryCatchPattern":"import { loadGroupConfig, GroupNotFoundError } from './core/group/config-parser.js';\n\ntry {\n  config = await loadGroupConfig(groupDir);\n} catch (err) {\n  if (err instanceof GroupNotFoundError) {\n    // Expected user error: report, don't crash. err.groupName carries the name.\n    return { error: 'not-found', message: `Group \"${err.groupName}\" is not registered. List groups first.` };\n  }\n  throw err; // parse errors, permission errors, etc. are real failures\n}","preventionTips":["Offer a group list command/resource in your UI so users pick an existing name instead of typing one.","Check <groupsRoot>/<name>/group.yaml existence before issuing @group queries (cheap fs stat).","Catch GroupNotFoundError by instanceof (or err.name === 'GroupNotFoundError') and render it as a 404-style message, never a stack trace.","After moving the checkout or groups root, re-verify the root path configuration before blaming group names."],"tags":["group","not-found","filesystem","configuration"],"backgroundTag":"config-file-not-found","analyzedSha":"52924ef12c2290ceee4612526a828ec4cdf2047f","analyzedAt":"2026-08-20T23:29:22.980Z","contentChangedAt":"2026-08-20T23:29:22.980Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}