abhigyanpatwari/GitNexus · error

${defaultRaw.key} must not be blank.

Error message

${defaultRaw.key} must not be blank.

What it means

Thrown by parseRepositoryPolicy when GITNEXUS_MCP_DEFAULT_REPO is defined but trims to an empty string. Like the allowlist check, this is a strict blank-value guard: the variable must either be unset or contain a non-whitespace repository specifier; a defined-but-blank default is treated as a configuration error, not silently ignored.

Source

Thrown at gitnexus/src/mcp/repository-policy.ts:48

}

function parseRepositoryPolicy(env: NodeJS.ProcessEnv): RawRepositoryPolicy {
  const allowedRaw = configuredValue(env, CANONICAL_ALLOWED);
  const defaultRaw = configuredValue(env, CANONICAL_DEFAULT);

  let allowed: string[] | undefined;
  if (allowedRaw) {
    allowed = allowedRaw.value
      .split(',')
      .map((entry) => entry.trim())
      .filter(Boolean);
    if (allowed.length === 0) throw new Error(`${allowedRaw.key} must not be blank.`);
  }

  let defaultRepo: string | undefined;
  if (defaultRaw) {
    defaultRepo = defaultRaw.value.trim();
    if (!defaultRepo) throw new Error(`${defaultRaw.key} must not be blank.`);
  }

  return { allowed, defaultRepo };
}

function normalizedPath(value: string): string {
  const resolved = path.resolve(value);
  return process.platform === 'win32' ? resolved.toLowerCase() : resolved;
}

function isAbsolutePath(value: string): boolean {
  return path.isAbsolute(value) || path.win32.isAbsolute(value);
}

function resolveSpecifier(
  specifier: string,
  registry: readonly ResolvedRepository[],
): { repo?: ResolvedRepository; reason?: 'invalid' | 'ambiguous' } {

View on GitHub (pinned to 52924ef12c)

Solutions

  1. Set the variable to a real repository name or absolute path, e.g. GITNEXUS_MCP_DEFAULT_REPO=/srv/repos/frontend.
  2. If no default is wanted, fully unset/remove the variable from the environment (docker: omit the -e flag; k8s: drop the env entry instead of using empty value).
  3. Audit .env files and CI variable blocks for empty-string vs missing entries.

Example fix

# before (docker)
docker run -e GITNEXUS_MCP_DEFAULT_REPO= ...

# after
docker run -e GITNEXUS_MCP_DEFAULT_REPO=/srv/repos/frontend ...
Defensive patterns

Strategy: validation

Validate before calling

const rawDefault = process.env.GITNEXUS_MCP_DEFAULT_REPO;
if (rawDefault !== undefined && rawDefault.trim() === '') {
  throw new Error('GITNEXUS_MCP_DEFAULT_REPO is blank — set a repo name/path or unset the variable.');
}

Type guard

const hasValidDefaultRepoEnv = (v: string | undefined): boolean =>
  v === undefined || v.trim().length > 0;

Prevention

When it happens

Trigger: Setting GITNEXUS_MCP_DEFAULT_REPO='' (explicitly, not unset), or to a whitespace-only value like ' ' or '\t'. Common with quoted empty expansions in launch scripts and CI env maps that distinguish null from empty string.

Common situations: Docker/Kubernetes env entries with value: "" (YAML), docker run -e GITNEXUS_MCP_DEFAULT_REPO= (empty assignment), or a systemd Environment= line with a placeholder that a templating step left blank.

Understand the failure class

Background: "is not a valid" / "Invalid ... value" environment variable errors: how libraries validate env vars and what to do when they reject yours — this error's family across 48 libraries.

Related errors


AI-assisted analysis of abhigyanpatwari/GitNexus@52924ef12c (2026-08-20). Data as JSON: /api/errors/7574f0535b6cc0ef. Report an issue: GitHub.