JuliusBrussee/caveman · error

caveman build: dataResidency is not enforced yet; refusing…

Error message

caveman build: dataResidency is not enforced yet; refusing to ignore residency policy

What it means

defineBuild accepts a BuildConfig where dataResidency is a declared-but-unenforced field. The library throws rather than silently accepting a residency policy it cannot guarantee, because ignoring a compliance directive is dangerous. This is a deliberate guard against false compliance.

Solutions

  1. Remove the dataResidency key from the defineBuild options until the library enforces it
  2. If residency is a hard requirement, gate usage at the application level (model allowlists per region) instead of relying on this field
  3. Track the library's support for dataResidency and re-add the field only when enforcement lands
  4. Centralize build definitions so removing the field is a one-place change

Example fix

// before
defineBuild({ entry, evals, dataResidency: "eu" });
// after
defineBuild({ entry, evals });
Defensive patterns

Strategy: validation

Validate before calling

if ("dataResidency" in options && options.dataResidency !== undefined) {
  throw new Error("dataResidency not supported by this caveman build version");
}

Prevention

When it happens

Trigger: Passing dataResidency (any string, e.g. "eu" or "us") in the options object to defineBuild, even alongside otherwise valid entry/evals.

Common situations: Porting an existing config that sets residency for another toolchain; a compliance checklist requiring the field be filled in; copying a config template that includes dataResidency before the feature ships.

Related errors


AI-assisted analysis of JuliusBrussee/caveman@3ee70a1026 (2026-09-20). Data as JSON: /api/errors/6b0d88d257aef20c. Report an issue: GitHub.

Appendix: source

Thrown at packages/agent/src/build.ts:28

export interface BuildConfig {
  entry: string;
  evals: string;
  efficiency: "max";
  requiredFixturePassRate: number;
  qualityRetention: number;
  maxSearchCostUsd: number;
  lock: "strict";
  sandbox: "required";
  allowedModels?: string[];
  deniedModels?: string[];
  maxP95LatencyMs?: number;
  forbiddenSafetyClasses?: string[];
  dataResidency?: string;
}

export function defineBuild(options: Partial<BuildConfig> & Pick<BuildConfig, "entry" | "evals">): BuildConfig {
  if (options.dataResidency !== undefined) {
    throw new Error(
      "caveman build: dataResidency is not enforced yet; refusing to ignore residency policy",
    );
  }
  const config: BuildConfig = {
    entry: options.entry,
    evals: options.evals,
    efficiency: options.efficiency ?? "max",
    requiredFixturePassRate: options.requiredFixturePassRate ?? 1,
    qualityRetention: options.qualityRetention ?? 0.98,
    maxSearchCostUsd: options.maxSearchCostUsd ?? 2,
    lock: options.lock ?? "strict",
    sandbox: options.sandbox ?? "required",
    ...(options.allowedModels === undefined ? {} : { allowedModels: [...options.allowedModels] }),
    ...(options.deniedModels === undefined ? {} : { deniedModels: [...options.deniedModels] }),
    ...(options.maxP95LatencyMs === undefined ? {} : { maxP95LatencyMs: options.maxP95LatencyMs }),
    ...(options.forbiddenSafetyClasses === undefined ? {} : { forbiddenSafetyClasses: [...options.forbiddenSafetyClasses] }),
  };
  if (!(config.requiredFixturePassRate > 0 && config.requiredFixturePassRate <= 1)) {

View on GitHub (pinned to 3ee70a1026)