{"record":{"id":"35b118408052e63b","repo":"abhigyanpatwari/GitNexus","slug":"name-is-required-in-group-yaml","errorCode":null,"errorMessage":"name is required in group.yaml","messagePattern":"name is required in group\\.yaml","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"gitnexus/src/core/group/config-parser.ts","lineNumber":58,"sourceCode":"};\n\nconst DEFAULT_MATCHING = {\n  exclude_links_paths: [] as string[],\n  exclude_links_param_only_paths: false,\n};\n\nexport function parseGroupConfig(yamlContent: string): GroupConfig {\n  const raw = yaml.load(yamlContent, { schema: yaml.JSON_SCHEMA }) as Record<string, unknown>;\n\n  if (!raw || typeof raw !== 'object' || Array.isArray(raw)) {\n    throw new Error('Invalid YAML: expected an object');\n  }\n\n  if (raw.version === undefined) throw new Error('version is required in group.yaml');\n  if (raw.version !== 1) {\n    throw new Error(`Unsupported group.yaml version: ${raw.version}. Expected 1.`);\n  }\n  if (!raw.name || typeof raw.name !== 'string') throw new Error('name is required in group.yaml');\n  if (!raw.repos || typeof raw.repos !== 'object' || Array.isArray(raw.repos)) {\n    throw new Error('repos is required in group.yaml (must be a mapping)');\n  }\n\n  const reposRaw = raw.repos as Record<string, unknown>;\n  const repos: Record<string, string> = {};\n  for (const [memberPath, registryName] of Object.entries(reposRaw)) {\n    if (typeof registryName !== 'string' || registryName.trim() === '') {\n      throw new Error(\n        `repos[\"${memberPath}\"] must be a non-empty registry name string, not ${typeof registryName}`,\n      );\n    }\n    repos[memberPath] = registryName.trim();\n  }\n  const repoPaths = new Set(Object.keys(repos));\n\n  const rawLinks = (raw.links as unknown[]) || [];\n  const links: GroupManifestLink[] = rawLinks.map((l: unknown, i: number) => {","sourceCodeStart":40,"sourceCodeEnd":76,"githubUrl":"https://github.com/abhigyanpatwari/GitNexus/blob/52924ef12c2290ceee4612526a828ec4cdf2047f/gitnexus/src/core/group/config-parser.ts#L40-L76","documentation":"Thrown by parseGroupConfig() when the group.yaml object lacks a `name` key or its value is not a non-empty string (falsy or non-string both fail). The name identifies the group in CLI output, MCP @group resolution, and status resources, so it is mandatory metadata for the manifest.","triggerScenarios":"Loading a group.yaml where name is missing, empty (name: ''), null, or a non-string (name: [a, b], name: {a: 1}).","commonSituations":"Renaming a group and accidentally deleting the key; leaving name: blank in a template; YAML autovivification turning an indented continuation line into a nested map instead of a string.","solutions":["Add a non-empty string name matching the group directory name convention, e.g. `name: my-group`.","Ensure the value is not quoted as another type or structured (plain scalar string, no nested mapping under name).","Keep name stable once the group is synced — it is used in @group references."],"exampleFix":"# before (group.yaml)\nversion: 1\nrepos:\n  services/api: https://github.com/org/api\n# -> Error: name is required in group.yaml\n\n# after\nversion: 1\nname: my-group\nrepos:\n  services/api: https://github.com/org/api","handlingStrategy":"validation","validationCode":"import yaml from 'js-yaml';\n\nexport function requireGroupName(content: string): void {\n  const doc = yaml.load(content, { schema: yaml.JSON_SCHEMA }) as Record<string, unknown>;\n  if (typeof doc.name !== 'string' || doc.name.trim() === '') {\n    throw new Error('group.yaml: `name` must be a non-empty string');\n  }\n}","typeGuard":"export const hasValidGroupName = (doc: unknown): doc is { name: string } =>\n  !!doc && typeof doc === 'object' && typeof (doc as { name?: unknown }).name === 'string' &&\n  (doc as { name: string }).name.length > 0;","tryCatchPattern":"try {\n  config = await loadGroupConfig(groupDir);\n} catch (err) {\n  if (err instanceof Error && err.message === 'name is required in group.yaml') {\n    throw new Error('group.yaml needs a non-empty `name` (plain string, matches the group directory)', { cause: err });\n  }\n  throw err;\n}","preventionTips":["Include `name` in the template you copy from; never delete it while editing other keys.","Keep name identical to the group directory name to avoid confusion in @group references.","Validate name/description are plain scalars — an indented continuation line turns name into a map and fails the check."],"tags":["yaml","configuration","validation","group","missing-field"],"backgroundTag":"missing-required-config-field","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"}