abhigyanpatwari/GitNexus · error

"springActuatorPath" must be a non-empty string

Error message

"springActuatorPath" must be a non-empty string

What it means

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.

Source

Thrown at gitnexus/src/server/api.ts:1537

          springActuatorPath,
          asyncApiSpecPath,
          token: repoToken,
        } = req.body;

        // Input type validation
        if (repoUrl !== undefined && typeof repoUrl !== 'string') {
          res.status(400).json({ error: '"url" must be a string' });
          return;
        }
        if (repoLocalPath !== undefined && typeof repoLocalPath !== 'string') {
          res.status(400).json({ error: '"path" must be a string' });
          return;
        }
        if (
          springActuatorPath !== undefined &&
          (typeof springActuatorPath !== 'string' || springActuatorPath.trim().length === 0)
        ) {
          res.status(400).json({ error: '"springActuatorPath" must be a non-empty string' });
          return;
        }
        if (
          asyncApiSpecPath !== undefined &&
          (typeof asyncApiSpecPath !== 'string' || asyncApiSpecPath.trim().length === 0)
        ) {
          res.status(400).json({ error: '"asyncApiSpecPath" must be a non-empty string' });
          return;
        }

        if (!repoUrl && !repoLocalPath) {
          res.status(400).json({ error: 'Provide "url" (git URL) or "path" (local path)' });
          return;
        }

        // Token: optional, restricted charset to prevent header smuggling
        // (CRLF), bound length, and bound to github.com (see validateAnalyzeToken).
        const tokenError = validateAnalyzeToken(repoToken, repoUrl);

View on GitHub (pinned to 0d1aed942f)

Solutions

  1. Omit `springActuatorPath` from the request body entirely if you do not want to set it.
  2. Provide a valid non-empty path string, e.g. "/actuator".
  3. Trim and validate the value client-side before sending; convert empty config values to omitted fields.
  4. Fix request content-type/serialization if a non-string type is being sent unintentionally.

Example fix

// before
curl -X POST localhost:4747/analyze -d '{"path":".","springActuatorPath":""}'
// after
curl -X POST localhost:4747/analyze -d '{"path":".","springActuatorPath":"/actuator"}'
Defensive patterns

Strategy: validation

Validate before calling

function validateSpringActuatorPath(v: unknown): string | undefined {
  if (v === undefined) return undefined;
  if (typeof v !== 'string' || v.trim().length === 0) throw new Error('springActuatorPath must be a non-empty string');
  return v;
}

Type guard

function isValidOptionalString(v: unknown): v is string {
  return typeof v === 'string' && v.trim().length > 0;
}

Try / catch

const res = await fetch(url, { method: 'POST', body: JSON.stringify(payload) });
if (res.status === 400) {
  const { error } = await res.json();
  if (error?.includes('springActuatorPath')) {
    delete payload.springActuatorPath; // retry without the field
  }
}

Prevention

When it happens

Trigger: 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).

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

Understand the failure class

Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.

Related errors


AI-assisted analysis of abhigyanpatwari/GitNexus@0d1aed942f (2026-09-08). Data as JSON: /api/errors/b508ad9b1dea3d11. Report an issue: GitHub.