Skip to content

gateway install --force drops MINIMAX_API_KEY from service-env despite managed keys list #90277

@Kvikkulf

Description

@Kvikkulf

Summary

On macOS (LaunchAgent), openclaw gateway install --force regenerates ~/.openclaw/service-env/ai.openclaw.gateway.env but does not export MINIMAX_API_KEY, even though:

  1. MINIMAX_API_KEY is present and non-empty in ~/.openclaw/.env
  2. MINIMAX_API_KEY appears in OPENCLAW_SERVICE_MANAGED_ENV_KEYS
  3. Other managed keys (e.g. MINIMAX_WEBSEARCH_API_KEY, DEEPSEEK_API_KEY, OPENROUTER_API_KEY) are exported correctly

The gateway then crashes immediately on startup:

SecretRefResolutionError: Environment variable "MINIMAX_API_KEY" is missing or empty.

Environment

  • OpenClaw version: 2026.6.1 (2e08f0f)
  • OS: macOS 26.5 (arm64)
  • Node: 22.22.3 (via nvm); LaunchAgent uses /opt/homebrew/bin/node
  • Service: LaunchAgent ai.openclaw.gateway.plist, port 18789

Config context

models.providers.minimax-openai.apiKey uses a proper env SecretRef:

"apiKey": {
  "source": "env",
  "provider": "default",
  "id": "MINIMAX_API_KEY"
}

(MINIMAX_WEBSEARCH_API_KEY in the minimax plugin uses the same SecretRef shape and does get exported.)

Reproduction

# Confirm key exists in .env
grep '^MINIMAX_API_KEY=' ~/.openclaw/.env   # non-empty

# Regenerate service env
openclaw gateway install --force

# MINIMAX_API_KEY missing from exports:
grep '^export MINIMAX_API_KEY=' ~/.openclaw/service-env/ai.openclaw.gateway.env || echo MISSING

# Gateway fails to start
openclaw gateway restart
openclaw gateway status --deep
# Runtime: stopped, Connectivity probe: failed, ECONNREFUSED :18789

Latest stability bundle message:

Startup failed: required secrets are unavailable.
SecretRefResolutionError: Environment variable "MINIMAX_API_KEY" is missing or empty.

Impact

  • LaunchAgent enters a crash loop; agent integrations lose connectivity
  • Watchdog recovery that only runs install --force re-triggers the bug on every attempt
  • Manual workaround: append export MINIMAX_API_KEY='...' to service-env after every install --force

Suggested fix

Ensure gateway install exports every key listed in OPENCLAW_SERVICE_MANAGED_ENV_KEYS when a non-empty value exists in ~/.openclaw/.env, with no special-casing that skips MINIMAX_API_KEY.

Metadata

Metadata

Assignees

Labels

P1High-priority user-facing bug, regression, or broken workflow.clawsweeper:needs-live-reproClawSweeper needs live local, crabbox, or manual validation to confirm this issue.impact:auth-providerAuth, provider routing, model choice, or SecretRef resolution may break.impact:crash-loopCrash, hang, restart loop, or process-level availability failure.issue-rating: 🐚 platinum hermitGood issue quality with a plausible reproduction path needing some confirmation.

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions