JuliusBrussee/caveman · error · Error

${name} must not contain surrounding whitespace

Error message

${name} must not contain surrounding whitespace

What it means

Error "${name} must not contain surrounding whitespace" thrown in JuliusBrussee/caveman.

Source

Thrown at packages/sdk/typescript/src/index.ts:336

  endTimeNs?: number;
  attributes?: Record<string, string | number | boolean>;
};

/** A span buffered by the OTel exporter (mirrors the OTLP/JSON span shape). */
export type OTelSpan = {
  name: string;
  traceId: string;
  spanId: string;
  parentSpanId: string;
  kind: number;
  startTimeNs: number;
  endTimeNs: number;
  statusCode: number; // 0=unset, 1=ok, 2=error
  attributes: Record<string, string | number | boolean>;
};

function normalizedServiceURL(value: string, name: "baseURL" | "controlURL"): string {
  if (value.trim() !== value) throw new Error(`${name} must not contain surrounding whitespace`);
  let parsed: URL;
  try {
    parsed = new URL(value);
  } catch {
    throw new Error(`${name} must be an absolute http(s) URL`);
  }
  if ((parsed.protocol !== "http:" && parsed.protocol !== "https:") || !parsed.hostname || parsed.username || parsed.password) {
    throw new Error(`${name} must be an absolute http(s) URL without credentials`);
  }
  if (parsed.search || parsed.hash) throw new Error(`${name} must not contain a query or fragment`);
  return value.replace(/\/+$/, "");
}

export class Cave {
  readonly options: CaveOptions;

  constructor(options: CaveOptions) {
    if (!options.apiKey || !options.baseURL || !options.agent) throw new Error("apiKey, baseURL, and agent are required");

View on GitHub (pinned to 27d5a3981a)

Solutions

  1. Trim surrounding whitespace from the value.

When it happens

Trigger: Thrown at packages/sdk/typescript/src/index.ts:336 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of JuliusBrussee/caveman@27d5a3981a (2026-08-15). Data as JSON: /api/errors/588eb6426c9308dd. Report an issue: GitHub.