jackwener/OpenCLI · error · ConfigError
Missing ${label}
Error message
Missing ${label} What it means
This ConfigError is thrown by normalizeBaseUrl() in clis/_atlassian/shared.js when the Atlassian base URL value (after trimming) is empty — i.e. no site URL was provided via config or environment (e.g. ATLASSIAN_SITE / ATLASSIAN_BASE_URL). The label in the message tells you which variable to set (e.g. "Missing ATLASSIAN_SITE").
Source
Thrown at clis/_atlassian/shared.js:25
ConfigError,
EmptyResultError,
} from '@jackwener/opencli/errors';
const USER_AGENT = 'opencli-atlassian-adapter (+https://github.com/jackwener/opencli)';
const DEPLOYMENTS = new Set(['cloud', 'datacenter', 'auto']);
function firstEnv(names) {
for (const name of names) {
const value = process.env[name]?.trim();
if (value) return value;
}
return '';
}
function normalizeBaseUrl(value, label) {
const raw = String(value ?? '').trim();
if (!raw) {
throw new ConfigError(`Missing ${label}`, `Set ${label}, for example https://example.atlassian.net`);
}
let parsed;
try {
parsed = new URL(raw);
} catch {
throw new ConfigError(`Invalid ${label}: ${raw}`, 'Use an absolute http(s) URL.');
}
if (parsed.protocol !== 'https:' && parsed.protocol !== 'http:') {
throw new ConfigError(`Invalid ${label}: ${raw}`, 'Use an http(s) URL.');
}
parsed.hash = '';
parsed.search = '';
return parsed.toString().replace(/\/+$/, '');
}
function parseDeployment(raw, baseUrl) {
const value = String(raw || 'auto').trim().toLowerCase();
if (!DEPLOYMENTS.has(value)) {View on GitHub (pinned to 49907e53dc)
Solutions
- Set the base URL environment variable named in the message, e.g. ATLASSIAN_SITE=https://example.atlassian.net
- If using a config file, add the site/base-url key the label refers to
- In CI, verify the secret is defined and exported with the exact env var name
- Check that your .env file is actually loaded (correct working directory / dotenv setup)
Example fix
// before export ATLASSIAN_SITE="" # Missing ATLASSIAN_SITE // after export ATLASSIAN_SITE="https://example.atlassian.net"
Defensive patterns
Strategy: validation
Validate before calling
const site = process.env.ATLASSIAN_SITE ?? '';
if (!site.trim()) throw new Error('Set ATLASSIAN_SITE, e.g. https://example.atlassian.net'); Type guard
const hasBaseUrl = (v) => typeof v === 'string' && v.trim().length > 0;
Try / catch
try {
return await cli.call('confluence.search', { cql });
} catch (e) {
if (e instanceof ConfigError && /^Missing /.test(e.message)) {
console.error('Configure your Atlassian base URL first, e.g. export ATLASSIAN_SITE=https://example.atlassian.net');
}
throw e;
} Prevention
- Set ATLASSIAN_SITE in .env and commit a .env.example
- Validate required env vars at script startup with a preflight check
- Use the exact env var name from the error message label
When it happens
Trigger: Running any Atlassian (Confluence/Jira) command without the base URL configured: env var unset or whitespace-only, config file missing the site key, or passing an empty string explicitly.
Common situations: Fresh install without copying the .env example, CI pipeline missing the secret/env var, typo'd env var name so the lookup falls through to empty, or .env file not loaded in the runtime.
Understand the failure class
Background: "environment variable is not set" and "Missing keys in environment" errors: what missing required env var messages mean and how to fix them — this error's family across 28 libraries.
Related errors
- Invalid ${label}: ${raw}
- WEREAD_API_KEY is not set. Export it with `export WEREAD_API
- ${label} returned HTTP ${resp.status}: ${summarizeApiError(p
- ${label} returned a non-JSON response
- ${label} is required
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/fd25942d700a382e.
Report an issue: GitHub.