{"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":57,"sourceCode":"  bm25_threshold: 0.7,\n  embedding_threshold: 0.65,\n  max_candidates_per_step: 3,\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 repos = raw.repos as Record<string, string>;\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) => {\n    const link = l as Record<string, unknown>;\n    if (!link.from || !repoPaths.has(link.from as string)) {\n      throw new Error(`links[${i}].from \"${link.from}\" does not match any repo path in group`);\n    }\n    if (!link.to || !repoPaths.has(link.to as string)) {\n      throw new Error(`links[${i}].to \"${link.to}\" does not match any repo path in group`);\n    }\n    if (!VALID_CONTRACT_TYPES.includes(link.type as ContractType)) {\n      throw new Error(","sourceCodeStart":39,"sourceCodeEnd":75,"githubUrl":"https://github.com/abhigyanpatwari/GitNexus/blob/d540b00184d71a896261ee02670da9a92d59d8f7/gitnexus/src/core/group/config-parser.ts#L39-L75","documentation":"Thrown by parseGroupConfig when the 'name' field is missing, falsy, or not a string. The name identifies the group in storage paths and contract registries, so a non-string value is rejected before it can corrupt downstream directory construction.","triggerScenarios":"group.yaml with no 'name' key; name set to null, an empty string, a number, or a boolean; a YAML parsing quirk where name is interpreted as a non-string type.","commonSituations":"Template left with name unset; name accidentally deleted during edit; name set to a numeric or boolean value (e.g. `name: 123`).","solutions":["Add `name: <your-group-name>` as a non-empty string.","Ensure the name also satisfies validateGroupName's regex (storage.ts: /^[a-zA-Z0-9][a-zA-Z0-9_-]*$/) to avoid a later failure when the directory is created."],"exampleFix":"# before\nversion: 1\nrepos: {}\n\n# after\nversion: 1\nname: my-service-group\nrepos: {}","handlingStrategy":"validation","validationCode":"const raw = yaml.load(text, { schema: yaml.JSON_SCHEMA }) as Record<string, unknown>;\nif (typeof raw.name !== 'string' || raw.name.length === 0) {\n  throw new Error('group.yaml requires a non-empty string name');\n}","typeGuard":"function hasValidGroupName(raw: Record<string, unknown>): raw is { name: string } & Record<string, unknown> {\n  return typeof raw.name === 'string' && raw.name.length > 0;\n}","tryCatchPattern":null,"preventionTips":["Always set name in group.yaml to a non-empty string.","Pre-validate the name with the same regex as validateGroupName (/^[a-zA-Z0-9][a-zA-Z0-9_-]*$/) so it also passes downstream directory creation.","Generate manifests via createGroupDir, which fills name from the validated group name."],"tags":["yaml","group-config","validation","config-parser"],"backgroundTag":null,"analyzedSha":"d540b00184d71a896261ee02670da9a92d59d8f7","analyzedAt":"2026-08-12T19:50:25.132Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}