tinyhumansai/openhuman · error · Error
OPENAI_API_KEY is required unless --no-ai or --dry-run is us
Error message
OPENAI_API_KEY is required unless --no-ai or --dry-run is used
What it means
summarizeWithOpenAi() needs an API key for the OpenAI Responses API. getOpenAiKey() checks OPENAI_API_KEY and the legacy OPENAI_API fallback and returned null, and neither --no-ai (deterministic Markdown rendering) nor --dry-run (print the request JSON instead of calling OpenAI) was passed — so the default AI path refuses to continue.
Source
Thrown at scripts/release/generate-release-notes.mjs:473
if (typeof responseJson.output_text === 'string') {
return responseJson.output_text;
}
const parts = [];
for (const item of responseJson.output || []) {
for (const content of item.content || []) {
if (typeof content.text === 'string') {
parts.push(content.text);
}
}
}
return parts.join('\n').trim();
}
async function summarizeWithOpenAi(request) {
const key = getOpenAiKey();
if (!key) {
throw new Error('OPENAI_API_KEY is required unless --no-ai or --dry-run is used');
}
const timeoutMs = 300_000;
const controller = new AbortController();
const timeout = setTimeout(() => controller.abort(), timeoutMs);
let response;
try {
response = await fetch('https://api.openai.com/v1/responses', {
method: 'POST',
signal: controller.signal,
headers: {
Authorization: `Bearer ${key}`,
'Content-Type': 'application/json',
},
body: JSON.stringify(request),
});
} catch (error) {
if (error?.name === 'AbortError') {View on GitHub (pinned to a221052e0d)
Solutions
- Export the key: export OPENAI_API_KEY=sk-... (or wire secrets.OPENAI_API_KEY into the CI job env)
- Skip AI entirely: pass --no-ai to use renderDeterministicNotes()
- Inspect the payload without a key: pass --dry-run to print the OpenAI request JSON
Example fix
# before node scripts/release/generate-release-notes.mjs --from v1.2.3 # Error: OPENAI_API_KEY is required... # after — option A (provide key) OPENAI_API_KEY="$CI_OPENAI_KEY" node scripts/release/generate-release-notes.mjs --from v1.2.3 # after — option B (no AI dependency) node scripts/release/generate-release-notes.mjs --from v1.2.3 --no-ai
Defensive patterns
Strategy: validation
Validate before calling
if [ -z "${OPENAI_API_KEY:-}" ] && [ -z "${OPENAI_API:-}" ]; then
echo 'no OpenAI key — falling back to --no-ai' >&2
set -- "$@" --no-ai
fi
node scripts/release/generate-release-notes.mjs "$@" Prevention
- map secrets.OPENAI_API_KEY into the CI job env
- make --no-ai the default in workflows that must not depend on OpenAI
- remember the legacy OPENAI_API fallback exists when grepping for key wiring
When it happens
Trigger: Invoking generate-release-notes.mjs with no key in the environment and neither escape hatch flag; note the key can also come from OPENAI_API (legacy) — both being absent triggers it.
Common situations: Local shell where the env var was never exported; CI job whose secrets block does not map OPENAI_API_KEY to env; expecting the script to read a .env file (it does not — it reads process.env only).
Related errors
- Could not resolve latest GitHub Release tag for ${repo}
- OpenAI Responses API timed out after ${timeoutMs}ms
- OpenAI response did not contain output text
- Sentry is not initialized in this binary — no DSN is resolva
- failed to load dotenv from OPENHUMAN_DOTENV_PATH={path}: {e}
AI-assisted analysis of tinyhumansai/openhuman@a221052e0d (2026-08-16).
Data as JSON: /api/errors/49ea0f1e46c5db49.
Report an issue: GitHub.