{"record":{"id":"b508ad9b1dea3d11","repo":"abhigyanpatwari/GitNexus","slug":"springactuatorpath-must-be-a-non-empty-string","errorCode":null,"errorMessage":"\"springActuatorPath\" must be a non-empty string","messagePattern":"\"springActuatorPath\" must be a non-empty string","errorType":"validation","errorClass":null,"httpStatus":400,"severity":"error","filePath":"gitnexus/src/server/api.ts","lineNumber":1537,"sourceCode":"          springActuatorPath,\n          asyncApiSpecPath,\n          token: repoToken,\n        } = req.body;\n\n        // Input type validation\n        if (repoUrl !== undefined && typeof repoUrl !== 'string') {\n          res.status(400).json({ error: '\"url\" must be a string' });\n          return;\n        }\n        if (repoLocalPath !== undefined && typeof repoLocalPath !== 'string') {\n          res.status(400).json({ error: '\"path\" must be a string' });\n          return;\n        }\n        if (\n          springActuatorPath !== undefined &&\n          (typeof springActuatorPath !== 'string' || springActuatorPath.trim().length === 0)\n        ) {\n          res.status(400).json({ error: '\"springActuatorPath\" must be a non-empty string' });\n          return;\n        }\n        if (\n          asyncApiSpecPath !== undefined &&\n          (typeof asyncApiSpecPath !== 'string' || asyncApiSpecPath.trim().length === 0)\n        ) {\n          res.status(400).json({ error: '\"asyncApiSpecPath\" must be a non-empty string' });\n          return;\n        }\n\n        if (!repoUrl && !repoLocalPath) {\n          res.status(400).json({ error: 'Provide \"url\" (git URL) or \"path\" (local path)' });\n          return;\n        }\n\n        // Token: optional, restricted charset to prevent header smuggling\n        // (CRLF), bound length, and bound to github.com (see validateAnalyzeToken).\n        const tokenError = validateAnalyzeToken(repoToken, repoUrl);","sourceCodeStart":1519,"sourceCodeEnd":1555,"githubUrl":"https://github.com/abhigyanpatwari/GitNexus/blob/0d1aed942f0e8b5d3bac27519fff441aceea722d/gitnexus/src/server/api.ts#L1519-L1555","documentation":"The GitNexus HTTP API (createServer) validates the `springActuatorPath` field in request bodies used to configure analysis targets. When the field is present but is not a string, or is a string that is empty/whitespace-only, the endpoint rejects the request with HTTP 400 and this message.","triggerScenarios":"Sending a POST request to the analyze/index endpoint whose JSON body includes `springActuatorPath` set to null, a number, a boolean, an object, \"\" or \"   \" (whitespace only). Absent is fine (undefined skips validation).","commonSituations":"Hand-written curl scripts with a placeholder value left empty; config generators emitting empty strings for unset optional fields; type coercion from YAML/env config that turns a missing value into \"\".","solutions":["Omit `springActuatorPath` from the request body entirely if you do not want to set it.","Provide a valid non-empty path string, e.g. \"/actuator\".","Trim and validate the value client-side before sending; convert empty config values to omitted fields.","Fix request content-type/serialization if a non-string type is being sent unintentionally."],"exampleFix":"// before\ncurl -X POST localhost:4747/analyze -d '{\"path\":\".\",\"springActuatorPath\":\"\"}'\n// after\ncurl -X POST localhost:4747/analyze -d '{\"path\":\".\",\"springActuatorPath\":\"/actuator\"}'","handlingStrategy":"validation","validationCode":"function validateSpringActuatorPath(v: unknown): string | undefined {\n  if (v === undefined) return undefined;\n  if (typeof v !== 'string' || v.trim().length === 0) throw new Error('springActuatorPath must be a non-empty string');\n  return v;\n}","typeGuard":"function isValidOptionalString(v: unknown): v is string {\n  return typeof v === 'string' && v.trim().length > 0;\n}","tryCatchPattern":"const res = await fetch(url, { method: 'POST', body: JSON.stringify(payload) });\nif (res.status === 400) {\n  const { error } = await res.json();\n  if (error?.includes('springActuatorPath')) {\n    delete payload.springActuatorPath; // retry without the field\n  }\n}","preventionTips":["Omit optional path fields rather than sending empty strings.","Validate request bodies against a JSON schema (required: type string, minLength 1) before sending.","Coerce empty config values (\"\", null) to undefined at config-load time.","Centralize payload construction so optional fields are only included when set."],"tags":["http-api","validation","http-400"],"backgroundTag":"invalid-argument-value","analyzedSha":"0d1aed942f0e8b5d3bac27519fff441aceea722d","analyzedAt":"2026-09-08T00:40:44.970Z","contentChangedAt":"2026-09-08T00:40:44.970Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}