nexu-io/open-design · error

public_github_repository_metric requires input.url

Error message

public_github_repository_metric requires input.url

What it means

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'.

Source

Thrown at apps/daemon/src/live-artifacts/refresh.ts:651

    runGit(dir, ['branch', '--show-current'], options.signal),
    runGit(dir, ['status', '--short'], options.signal),
    runGit(dir, ['log', `--max-count=${maxCommits}`, '--pretty=format:%h %s'], options.signal),
    runGit(dir, ['diff', '--stat', '--', '.'], options.signal),
  ]);

  return asBoundedRefreshOutput({
    toolName: 'git.summary',
    isRepository: true,
    branch: branch.trim(),
    status: compactExecOutput(status),
    recentCommits: compactExecOutput(recentCommits),
    diffStat: compactExecOutput(diffStat),
  });
}

function selectGithubRepositoryApiUrl(input: PublicGithubRepositoryMetricInput): URL {
  const rawUrl = optionalString(input.url, 'input.url');
  if (rawUrl === undefined) throw new Error('public_github_repository_metric requires input.url');

  let url: URL;
  try {
    url = new URL(rawUrl);
  } catch {
    throw new Error('public_github_repository_metric input.url must be a valid URL');
  }

  if (url.protocol !== 'https:' || url.hostname !== 'api.github.com') {
    throw new Error('public_github_repository_metric only supports https://api.github.com repository URLs');
  }
  if (!/^\/repos\/[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+$/.test(url.pathname)) {
    throw new Error('public_github_repository_metric only supports /repos/{owner}/{repo} URLs');
  }
  url.search = '';
  url.hash = '';
  url.username = '';
  url.password = '';

View on GitHub (pinned to 5be4028344)

Solutions

  1. Set input.url to a valid GitHub API repository URL (https://api.github.com/repos/<owner>/<repo>).
  2. Confirm the field name is exactly 'url' and that it is a string.
  3. Validate the public_github_repository_metric input has a url before scheduling refresh.

Example fix

// before
const input = {};
// throws `public_github_repository_metric requires input.url`

// after
const input = { url: 'https://api.github.com/repos/octocat/Hello-World' };
Defensive patterns

Strategy: validation

Validate before calling

function requireGithubUrl(input: { url?: unknown }): string {
  if (typeof input.url !== 'string' || input.url.length === 0) {
    throw new Error('public_github_repository_metric requires input.url');
  }
  return input.url;
}

Type guard

function hasGithubUrl(input: unknown): input is { url: string } {
  return typeof input === 'object' && input !== null
    && typeof (input as { url?: unknown }).url === 'string';
}

Prevention

When it happens

Trigger: A public_github_repository_metric source.input has no `url` field (or it is explicitly undefined).

Common situations: 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.

Related errors


AI-assisted analysis of nexu-io/open-design@5be4028344 (2026-08-12). Data as JSON: /api/errors/2031cb372c4e2bd6. Report an issue: GitHub.