Hmbown/CodeWhale · error · Error

${names.join(" or ")} is required

Error message

${names.join(" or ")} is required

What it means

requiredEnvFirst(...names) accepts the first non-empty value among alternative env names and throws `${names.join(" or ")} is required` when every name is missing. The telegram bridge uses it for the runtime token: requiredEnvFirst("CODEWHALE_RUNTIME_TOKEN", "DEEPSEEK_RUNTIME_TOKEN") at index.mjs:51, so the message reads 'CODEWHALE_RUNTIME_TOKEN or DEEPSEEK_RUNTIME_TOKEN is required'.

Source

Thrown at integrations/telegram-bridge/src/index.mjs:985

    error.description = payload?.description || "";
    error.parameters = payload?.parameters || {};
    throw error;
  }
  return payload.result;
}

function requiredEnv(name) {
  const value = process.env[name];
  if (!value || !value.trim()) {
    throw new Error(`${name} is required`);
  }
  return value.trim();
}

function requiredEnvFirst(...names) {
  const value = envFirst(process.env, ...names);
  if (!value) {
    throw new Error(`${names.join(" or ")} is required`);
  }
  return value;
}

function delay(ms) {
  return new Promise((resolve) => setTimeout(resolve, ms));
}

View on GitHub (pinned to 8880682c63)

Solutions

  1. Set the canonical name: `export CODEWHALE_RUNTIME_TOKEN=<token issued by the runtime>`
  2. During migration, mirror the value to DEEPSEEK_RUNTIME_TOKEN so older tooling keeps working
  3. Check what the service manager actually injects (`systemctl show <unit> -p Environment`, `docker inspect`) — the name may be missing or misspelled

Example fix

# before: only the legacy name, blank
export DEEPSEEK_RUNTIME_TOKEN=
# after
export CODEWHALE_RUNTIME_TOKEN='s3cr3t'
Defensive patterns

Strategy: validation

Validate before calling

const runtimeToken = ['CODEWHALE_RUNTIME_TOKEN', 'DEEPSEEK_RUNTIME_TOKEN']
  .map((name) => process.env[name]?.trim())
  .find(Boolean);
if (!runtimeToken) {
  console.error('Set CODEWHALE_RUNTIME_TOKEN (or legacy DEEPSEEK_RUNTIME_TOKEN)');
  process.exit(2);
}

Try / catch

try {
  startBridge();
} catch (error) {
  if (/CODEWHALE_RUNTIME_TOKEN or DEEPSEEK_RUNTIME_TOKEN is required/.test(error.message)) {
    process.exit(2);
  }
  throw error;
}

Prevention

When it happens

Trigger: Starting the bridge with neither CODEWHALE_RUNTIME_TOKEN nor DEEPSEEK_RUNTIME_TOKEN set, or with both blank (empty-string or whitespace-only values).

Common situations: Migrating deployments from the legacy DEEPSEEK_* variable names to CODEWHALE_*; an env template that predates the rename; pointing the bridge at a token-protected runtime without provisioning a token.

Related errors


AI-assisted analysis of Hmbown/CodeWhale@8880682c63 (2026-08-16). Data as JSON: /api/errors/4cbaf7e5bb088a37. Report an issue: GitHub.