{"record":{"id":"0ad7c0151b227bb9","repo":"abhigyanpatwari/GitNexus","slug":"links-i-to-link-to-does-not-match-any-rep","errorCode":null,"errorMessage":"links[${i}].to \"${link.to}\" does not match any repo path in group","messagePattern":"links\\[(.+?)\\]\\.to \"(.+?)\" does not match any repo path in group","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"gitnexus/src/core/group/config-parser.ts","lineNumber":72,"sourceCode":"  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(\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,","sourceCodeStart":54,"sourceCodeEnd":90,"githubUrl":"https://github.com/abhigyanpatwari/GitNexus/blob/d540b00184d71a896261ee02670da9a92d59d8f7/gitnexus/src/core/group/config-parser.ts#L54-L90","documentation":"Thrown during links[] validation when a link's 'to' field is missing or not present in the repoPaths set derived from the repos mapping keys. Symmetric with the 'from' check (error 147): both endpoints of every link must reference declared repos.","triggerScenarios":"A link whose 'to' references a repo path not in repos; a link missing the 'to' field; a path-convention mismatch between the link and the repos key.","commonSituations":"Same as 147: inconsistent path prefixes, repo renamed in one place but not the other, or a stale link from a previous group config.","solutions":["Compare link.to verbatim against the repos mapping keys.","Add the missing repo to repos, or fix the link.to path to match an existing key.","Use the index i from the message to find the offending entry."],"exampleFix":"# before — 'to' repo not declared\nrepos:\n  services/api: ./services/api\nlinks:\n  - { from: services/api, to: services/missing, type: http, contract: GET /v1, role: provider }\n\n# after — declare the missing repo\nrepos:\n  services/api: ./services/api\n  services/missing: ./services/missing\nlinks:\n  - { from: services/api, to: services/missing, type: http, contract: GET /v1, role: provider }","handlingStrategy":"validation","validationCode":"function validateLinksTo(raw: Record<string, unknown>): string[] {\n  const repoPaths = new Set(Object.keys(raw.repos as Record<string, string>));\n  const errs: string[] = [];\n  ((raw.links as unknown[]) || []).forEach((l, i) => {\n    const link = l as Record<string, unknown>;\n    if (typeof link.to !== 'string' || !repoPaths.has(link.to)) {\n      errs.push(`links[${i}].to \"${String(link.to)}\" not in repos`);\n    }\n  });\n  return errs;\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Apply the same path convention to link.to as to link.from and repos keys.","Validate both endpoints against the repos set in a pre-flight lint pass.","Use the index from the error message to jump straight to the offending link."],"tags":["yaml","group-config","links","validation","config-parser"],"backgroundTag":null,"analyzedSha":"d540b00184d71a896261ee02670da9a92d59d8f7","analyzedAt":"2026-08-12T19:50:25.132Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}