Hmbown/CodeWhale · critical · Error
${name} is required
Error message
${name} is required What it means
requiredEnv() is the Feishu bridge's fail-fast bootstrap guard: the named environment variable must exist and contain non-whitespace, otherwise the process throws `<NAME> is required` instead of starting half-configured. The message names the exact missing variable.
Source
Thrown at integrations/feishu-bridge/src/index.mjs:585
data: body
});
continue;
} catch (error) {
canReply = false;
console.warn("Feishu reply API failed; falling back to message create", error);
}
}
await createMessage({
params: { receive_id_type: "chat_id" },
data: { ...body, receive_id: chatId }
});
}
}
function requiredEnv(name) {
const value = process.env[name];
if (!value || !value.trim()) {
throw new Error(`${name} is required`);
}
return value.trim();
}
function resolveLarkDomain(domain) {
const normalized = String(domain || "feishu").toLowerCase();
if (normalized === "lark") return Lark.Domain?.Lark || "https://open.larksuite.com";
if (normalized === "feishu") return Lark.Domain?.Feishu || "https://open.feishu.cn";
return domain;
}
View on GitHub (pinned to 8880682c63)
Solutions
- Set the variable named in the message (export it, add to .env, or inject via secret manager)
- Run the bundled validator (integrations/feishu-bridge/scripts/validate-config.mjs) to list all missing values at once
- Restart the bridge after setting it
Example fix
# before - throws: FEISHU_APP_SECRET is required node src/index.mjs # after export FEISHU_APP_ID=cli_xxxx export FEISHU_APP_SECRET=******** node src/index.mjs
Defensive patterns
Strategy: validation
Validate before calling
// preflight before starting the bridge (names follow requiredEnv usage)
const REQUIRED = ['FEISHU_APP_ID', 'FEISHU_APP_SECRET'];
const missing = REQUIRED.filter((name) => !(process.env[name] || '').trim());
if (missing.length) {
console.error('missing required env:', missing.join(', '));
process.exit(1);
} Prevention
- Run scripts/validate-config.mjs before every deploy of the bridge
- Declare required env in the systemd/docker unit so startup fails loudly
- Keep .env.example in sync with requiredEnv() call sites
When it happens
Trigger: Starting the bridge without the required vars (e.g. FEISHU_APP_ID / FEISHU_APP_SECRET or whichever env the startup path reads); a .env file not loaded in the deployment; a variable set to empty string or spaces.
Common situations: New deploy missing secrets; docker/systemd units dropping env; CI running the bridge with stub env; the variable renamed between versions.
Related errors
- ${name} is required
- ${names.join(" or ")} is required
- ${name} is required
- CF_ACCOUNT_ID and CF_API_TOKEN are required
- Failed to parse config file {}; file contents were omitted
AI-assisted analysis of Hmbown/CodeWhale@8880682c63 (2026-08-16).
Data as JSON: /api/errors/ddeb11a3079f0904.
Report an issue: GitHub.