{"record":{"id":"c193a177a6557bd0","repo":"abhigyanpatwari/GitNexus","slug":"links-i-contract-is-required","errorCode":null,"errorMessage":"links[${i}].contract is required","messagePattern":"links\\[(.+?)\\]\\.contract is required","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"gitnexus/src/core/group/config-parser.ts","lineNumber":87,"sourceCode":"      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(\n        `links[${i}].type \"${link.type}\" is invalid. Expected: ${VALID_CONTRACT_TYPES.join(', ')}`,\n      );\n    }\n    if (!VALID_ROLES.includes(link.role as ContractRole)) {\n      throw new Error(`links[${i}].role \"${link.role}\" is invalid. Expected: provider | consumer`);\n    }\n    if (\n      link.contract === undefined ||\n      link.contract === null ||\n      String(link.contract).trim() === ''\n    ) {\n      throw new Error(`links[${i}].contract is required`);\n    }\n    return {\n      from: link.from as string,\n      to: link.to as string,\n      type: link.type as ContractType,\n      contract: String(link.contract),\n      role: link.role as ContractRole,\n    };\n  });\n\n  const detect = { ...DEFAULT_DETECT, ...((raw.detect as object) || {}) };\n  const matching = { ...DEFAULT_MATCHING, ...((raw.matching as object) || {}) };\n  const packages = (raw.packages as Record<string, Record<string, string>>) || {};\n\n  return {\n    version: 1,\n    name: raw.name as string,\n    description: (raw.description as string) || '',","sourceCodeStart":69,"sourceCodeEnd":105,"githubUrl":"https://github.com/abhigyanpatwari/GitNexus/blob/d540b00184d71a896261ee02670da9a92d59d8f7/gitnexus/src/core/group/config-parser.ts#L69-L105","documentation":"Thrown during links[] validation when a link's 'contract' field is undefined, null, or trims to an empty string. The contract field carries the contract identifier (e.g. an HTTP route like 'GET /v1/users', a grpc method fully-qualified name, a topic name). It is required because a link without a contract binds no actual consumer-provider relationship.","triggerScenarios":"A link missing the 'contract' key; contract: null; contract: '' or contract: '   ' (whitespace-only).","commonSituations":"Hand-authored link left with a placeholder empty contract; the contract field accidentally deleted during edit; a template with contract: TODO that was never filled in.","solutions":["Set link.contract to a non-empty string describing the actual contract: an HTTP route (e.g. 'GET /v1/users'), a grpc method (e.g. 'pkg.Svc/Method'), a topic name, or a library/include identifier.","If the contract isn't known yet, remove the entire link entry — partial links are not allowed."],"exampleFix":"# before — empty placeholder contract\nlinks:\n  - { from: services/api, to: services/worker, type: http, contract: '', role: provider }\n\n# after\nlinks:\n  - { from: services/api, to: services/worker, type: http, contract: 'GET /v1/users', role: provider }","handlingStrategy":"validation","validationCode":"function hasNonEmptyContract(link: Record<string, unknown>): boolean {\n  return link.contract !== undefined && link.contract !== null &&\n    typeof link.contract === 'string' && link.contract.trim().length > 0;\n}","typeGuard":"function linkHasContract(link: unknown): link is { contract: string } {\n  return typeof (link as Record<string, unknown>)?.contract === 'string' &&\n    ((link as Record<string, unknown>).contract as string).trim().length > 0;\n}","tryCatchPattern":null,"preventionTips":["Fill the contract field with the real route/method/topic — never leave a TODO or empty string.","If a link's contract isn't known, omit the whole link until it is.","Lint group.yaml to reject links whose contract trims to empty."],"tags":["yaml","group-config","links","validation","contract","config-parser"],"backgroundTag":null,"analyzedSha":"d540b00184d71a896261ee02670da9a92d59d8f7","analyzedAt":"2026-08-12T19:50:25.132Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}