Bug
Scheduled jobs fail with Model not found / ProviderModelNotFoundError because the generated launchd plist only injects PATH into EnvironmentVariables — the OPENCODE_API_KEY is missing.
When launchd spawns the supervisor, the process has a minimal environment with no API key, so opencode can't authenticate with any provider through the opencode proxy.
Where
src/index.ts ~line 1071 — the plist template:
<key>EnvironmentVariables</key>
<dict>
<key>PATH</key>
<string>${enhancedPath}</string>
</dict>
Only PATH is injected. The OPENCODE_API_KEY from the user's session is not captured or forwarded.
Expected
At job creation time, the scheduler should capture OPENCODE_API_KEY from the current environment and inject it into the plist EnvironmentVariables dict so the supervisor can authenticate when running opencode.
Repro
opencode (authenticated via opencode.ai)
/schedule 1m "say hello"
- Job is created, launchd plist written
- Next minute:
Model not found because OPENCODE_API_KEY is missing from launchd env
Workaround
Manually edit the plist to add:
<key>OPENCODE_API_KEY</key>
<string>your-key</string>
Then launchctl unload/load the plist.
Environment
- opencode 1.3.2
- opencode-scheduler 1.3.0
- macOS (launchd)
Bug
Scheduled jobs fail with
Model not found/ProviderModelNotFoundErrorbecause the generated launchd plist only injectsPATHintoEnvironmentVariables— theOPENCODE_API_KEYis missing.When launchd spawns the supervisor, the process has a minimal environment with no API key, so opencode can't authenticate with any provider through the opencode proxy.
Where
src/index.ts~line 1071 — the plist template:Only
PATHis injected. TheOPENCODE_API_KEYfrom the user's session is not captured or forwarded.Expected
At job creation time, the scheduler should capture
OPENCODE_API_KEYfrom the current environment and inject it into the plistEnvironmentVariablesdict so the supervisor can authenticate when running opencode.Repro
opencode(authenticated via opencode.ai)/schedule 1m "say hello"Model not foundbecauseOPENCODE_API_KEYis missing from launchd envWorkaround
Manually edit the plist to add:
Then
launchctl unload/loadthe plist.Environment