{"record":{"id":"2031cb372c4e2bd6","repo":"nexu-io/open-design","slug":"public-github-repository-metric-requires-input-url","errorCode":null,"errorMessage":"public_github_repository_metric requires input.url","messagePattern":"public_github_repository_metric requires input\\.url","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"apps/daemon/src/live-artifacts/refresh.ts","lineNumber":651,"sourceCode":"    runGit(dir, ['branch', '--show-current'], options.signal),\n    runGit(dir, ['status', '--short'], options.signal),\n    runGit(dir, ['log', `--max-count=${maxCommits}`, '--pretty=format:%h %s'], options.signal),\n    runGit(dir, ['diff', '--stat', '--', '.'], options.signal),\n  ]);\n\n  return asBoundedRefreshOutput({\n    toolName: 'git.summary',\n    isRepository: true,\n    branch: branch.trim(),\n    status: compactExecOutput(status),\n    recentCommits: compactExecOutput(recentCommits),\n    diffStat: compactExecOutput(diffStat),\n  });\n}\n\nfunction selectGithubRepositoryApiUrl(input: PublicGithubRepositoryMetricInput): URL {\n  const rawUrl = optionalString(input.url, 'input.url');\n  if (rawUrl === undefined) throw new Error('public_github_repository_metric requires input.url');\n\n  let url: URL;\n  try {\n    url = new URL(rawUrl);\n  } catch {\n    throw new Error('public_github_repository_metric input.url must be a valid URL');\n  }\n\n  if (url.protocol !== 'https:' || url.hostname !== 'api.github.com') {\n    throw new Error('public_github_repository_metric only supports https://api.github.com repository URLs');\n  }\n  if (!/^\\/repos\\/[A-Za-z0-9_.-]+\\/[A-Za-z0-9_.-]+$/.test(url.pathname)) {\n    throw new Error('public_github_repository_metric only supports /repos/{owner}/{repo} URLs');\n  }\n  url.search = '';\n  url.hash = '';\n  url.username = '';\n  url.password = '';","sourceCodeStart":633,"sourceCodeEnd":669,"githubUrl":"https://github.com/nexu-io/open-design/blob/5be4028344c2eb4c667c5a97bda8f750c5597ef7/apps/daemon/src/live-artifacts/refresh.ts#L633-L669","documentation":"selectGithubRepositoryApiUrl (refresh.ts:649-651) reads input.url via optionalString; if it is absent (undefined), the tool cannot construct the GitHub API request and throws. Note the source type for this tool is 'public_github_repository_metric'.","triggerScenarios":"A public_github_repository_metric source.input has no `url` field (or it is explicitly undefined).","commonSituations":"The source was created without a URL; the URL key was misspelled (e.g. 'href', 'repo'); a default-constructed input object; a migration that dropped the url field.","solutions":["Set input.url to a valid GitHub API repository URL (https://api.github.com/repos/<owner>/<repo>).","Confirm the field name is exactly 'url' and that it is a string.","Validate the public_github_repository_metric input has a url before scheduling refresh."],"exampleFix":"// before\nconst input = {};\n// throws `public_github_repository_metric requires input.url`\n\n// after\nconst input = { url: 'https://api.github.com/repos/octocat/Hello-World' };","handlingStrategy":"validation","validationCode":"function requireGithubUrl(input: { url?: unknown }): string {\n  if (typeof input.url !== 'string' || input.url.length === 0) {\n    throw new Error('public_github_repository_metric requires input.url');\n  }\n  return input.url;\n}","typeGuard":"function hasGithubUrl(input: unknown): input is { url: string } {\n  return typeof input === 'object' && input !== null\n    && typeof (input as { url?: unknown }).url === 'string';\n}","tryCatchPattern":null,"preventionTips":["Always set input.url when creating a public_github_repository_metric source.","Use the typed PublicgithubRepositoryMetricInput so a missing url fails typecheck.","Validate that url is a string and a valid https://api.github.com URL before scheduling refresh."],"tags":["live-artifacts","github","input-validation"],"backgroundTag":null,"analyzedSha":"5be4028344c2eb4c667c5a97bda8f750c5597ef7","analyzedAt":"2026-08-12T12:03:58.812Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}