{"record":{"id":"7574f0535b6cc0ef","repo":"abhigyanpatwari/GitNexus","slug":"defaultraw-key-must-not-be-blank","errorCode":null,"errorMessage":"${defaultRaw.key} must not be blank.","messagePattern":"(.+?) must not be blank\\.","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"gitnexus/src/mcp/repository-policy.ts","lineNumber":48,"sourceCode":"}\n\nfunction parseRepositoryPolicy(env: NodeJS.ProcessEnv): RawRepositoryPolicy {\n  const allowedRaw = configuredValue(env, CANONICAL_ALLOWED);\n  const defaultRaw = configuredValue(env, CANONICAL_DEFAULT);\n\n  let allowed: string[] | undefined;\n  if (allowedRaw) {\n    allowed = allowedRaw.value\n      .split(',')\n      .map((entry) => entry.trim())\n      .filter(Boolean);\n    if (allowed.length === 0) throw new Error(`${allowedRaw.key} must not be blank.`);\n  }\n\n  let defaultRepo: string | undefined;\n  if (defaultRaw) {\n    defaultRepo = defaultRaw.value.trim();\n    if (!defaultRepo) throw new Error(`${defaultRaw.key} must not be blank.`);\n  }\n\n  return { allowed, defaultRepo };\n}\n\nfunction normalizedPath(value: string): string {\n  const resolved = path.resolve(value);\n  return process.platform === 'win32' ? resolved.toLowerCase() : resolved;\n}\n\nfunction isAbsolutePath(value: string): boolean {\n  return path.isAbsolute(value) || path.win32.isAbsolute(value);\n}\n\nfunction resolveSpecifier(\n  specifier: string,\n  registry: readonly ResolvedRepository[],\n): { repo?: ResolvedRepository; reason?: 'invalid' | 'ambiguous' } {","sourceCodeStart":30,"sourceCodeEnd":66,"githubUrl":"https://github.com/abhigyanpatwari/GitNexus/blob/52924ef12c2290ceee4612526a828ec4cdf2047f/gitnexus/src/mcp/repository-policy.ts#L30-L66","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Set the variable to a real repository name or absolute path, e.g. GITNEXUS_MCP_DEFAULT_REPO=/srv/repos/frontend.","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).","Audit .env files and CI variable blocks for empty-string vs missing entries."],"exampleFix":"# before (docker)\ndocker run -e GITNEXUS_MCP_DEFAULT_REPO= ...\n\n# after\ndocker run -e GITNEXUS_MCP_DEFAULT_REPO=/srv/repos/frontend ...","handlingStrategy":"validation","validationCode":"const rawDefault = process.env.GITNEXUS_MCP_DEFAULT_REPO;\nif (rawDefault !== undefined && rawDefault.trim() === '') {\n  throw new Error('GITNEXUS_MCP_DEFAULT_REPO is blank — set a repo name/path or unset the variable.');\n}","typeGuard":"const hasValidDefaultRepoEnv = (v: string | undefined): boolean =>\n  v === undefined || v.trim().length > 0;","tryCatchPattern":null,"preventionTips":["In Docker/Kubernetes, omit the env entry entirely rather than setting it to an empty string.","Distinguish 'unset' from 'empty' in deployment templates; this server treats empty as an error, not as unset.","Validate MCP env vars in a preflight step of the deploy pipeline."],"tags":["mcp","default-repository","environment-variables","validation","configuration"],"backgroundTag":"invalid-env-var-value","analyzedSha":"52924ef12c2290ceee4612526a828ec4cdf2047f","analyzedAt":"2026-08-20T23:29:22.980Z","contentChangedAt":"2026-08-20T23:29:22.980Z","schemaVersion":2},"datasetVersion":"2026-09-08T15:18:49.778Z"}