abhigyanpatwari/GitNexus · error
must not be blank.
Error message
${allowedRaw.key} must not be blank. What it means
Thrown by parseRepositoryPolicy when GITNEXUS_MCP_ALLOWED_REPOS is defined but contains no usable entries. The value is split on commas, each entry trimmed, and empty entries filtered out; if nothing survives, the allowlist variable is effectively blank and the server refuses to start rather than silently allowing nothing (or everything). The message names the exact offending variable key.
Solutions
- Set the variable to a comma-separated list of repository names or absolute paths with at least one real entry, e.g. GITNEXUS_MCP_ALLOWED_REPOS='frontend,backend'.
- If you did not intend an allowlist, remove the variable from the environment instead of leaving a placeholder.
- Verify what the process actually sees: print process.env.GITNEXUS_MCP_ALLOWED_REPOS.length and its JSON representation from the server context.
Example fix
# before export GITNEXUS_MCP_ALLOWED_REPOS="$REPOS" # REPOS unset -> blank # after export GITNEXUS_MCP_ALLOWED_REPOS="frontend,backend"
Defensive patterns
Strategy: validation
Validate before calling
const rawAllowed = process.env.GITNEXUS_MCP_ALLOWED_REPOS;
if (rawAllowed !== undefined) {
const entries = rawAllowed.split(',').map((s) => s.trim()).filter(Boolean);
if (entries.length === 0) {
throw new Error('GITNEXUS_MCP_ALLOWED_REPOS is blank — set a real list or unset it.');
}
} Type guard
const hasValidAllowlistEnv = (v: string | undefined): boolean =>
v === undefined || v.split(',').some((s) => s.trim().length > 0); Prevention
- In launch scripts use ${VAR:-} carefully: an unset variable exported with quotes becomes an empty value; prefer conditional export.
- Add CI checks that fail when an allowlist env resolves to a commas/whitespace-only string.
- Log the effective (parsed) configuration at startup so blank lists are visible immediately.
When it happens
Trigger: Setting GITNEXUS_MCP_ALLOWED_REPOS=',', ' , ', ',,,', or a value made only of whitespace. Note an unset variable is fine; an empty string value also passes this check but yields no restriction only when combined with no default — the blank-comma case is the hard failure.
Common situations: A deploy script exports the variable from an empty shell variable: GITNEXUS_MCP_ALLOWED_REPOS="$REPOS" where REPOS is unset-but-quoted becomes ''. More commonly, a YAML/CI env block has a placeholder like 'repo1, ' with the real list never substituted, or a trailing/duplicate commas-only value survives templating.
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
- must not be blank.
- GITNEXUS_MCP_READ_ONLY must be 0 or 1.
- must be a positive integer.
- Group routing is unavailable when an MCP repository…
- Group tools are unavailable when an MCP repository…
AI-assisted analysis of abhigyanpatwari/GitNexus@ac9a4e9abd (2026-08-20).
Data as JSON: /api/errors/d16a3debee5f950d.
Report an issue: GitHub.
Appendix: source
Thrown at gitnexus/src/mcp/repository-policy.ts:42
function configuredValue(
env: NodeJS.ProcessEnv,
key: string,
): { key: string; value: string } | undefined {
const value = env[key];
return value === undefined ? undefined : { key, value };
}
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);View on GitHub (pinned to ac9a4e9abd)