Closed
Description
Issue Description
When I run oco
, I encounter the following error:
$ oco
Applying migration 00_use_single_api_key_and_url
│
└─ Failed to apply migration 00_use_single_api_key_and_url: Error: Migration failed, set AI provider first. Run "oco config set OCO_AI_PROVIDER=<provider>", where <provider> is one of: ollama, openai, anthropic, gemini, azure, test, flowise, groq, mistral, mlx, deepseek
Configuration File
$ cat ~/.opencommit
OCO_AI_PROVIDER=deepseek
OCO_MODEL=deepseek-reasoner
OCO_API_URL=https://api.deepseek.com
OCO_API_KEY=sk-xxx
OCO_TOKENS_MAX_INPUT=40960
OCO_TOKENS_MAX_OUTPUT=4096
OCO_DESCRIPTION=false
OCO_EMOJI=true
OCO_LANGUAGE=en
OCO_MESSAGE_TEMPLATE_PLACEHOLDER=$msg
OCO_PROMPT_MODULE=conventional-commit
OCO_ONE_LINE_COMMIT=true
OCO_TEST_MOCK_TYPE=commit-message
OCO_OMIT_SCOPE=false
OCO_GITPUSH=true
OCO_WHY=false
System Information
$ uname -a
Linux DESKTOP-ITA59KV 6.6.84.1-microsoft-standard-WSL2 #1 SMP PREEMPT_DYNAMIC Tue Apr 1 19:37:06 UTC 2025 x86_64 GNU/Linux
Any help would be appreciated. 🙏
Metadata
Metadata
Assignees
Labels
No labels
Activity
di-sukharev commentedon Apr 30, 2025
hi, did you try to update to latest version
npm i -g opencommit@latest
? but anyway i think the fastest and cleanest way is to delete opencommit from your global node_modules and install it again. be careful, Node.js installs global packages in different versions, e.g. if you ever switched node version (via nvm or else) then opencommit can be in multiple folders, likenode/21.0.1/node_modules/opencommit
andnode/19.0.1/node_modules/opencommit
, i suggest you remove every one of them and install again withnpm i -g opencommit@latest
yshngg commentedon Apr 30, 2025
Hi @di-sukharev , thanks for the quick response!
I suspect the issue may be caused by: I initially installed opencommit via Bun but encountered shebang execution errors. Subsequently, I installed it through Node.js, resulting in multiple installations across different locations.
I will later reinstall opencommit to confirm this hypothesis.
yshngg commentedon Apr 30, 2025
Unfortunately, I still encountered the error:
Steps I Performed:
1. Uninstalled bun
rm -rf ~/.bun
2. Uninstalled oco/opencommit
3. Reinstalled opencommit
4. Attempted to run opencommit
5. Additional environment information
di-sukharev commentedon Apr 30, 2025
okay, could you confirm there are no opencommits installed in different node versions? it should be in
Users/<you>/.nvm/versions/node/<version>/<here>
wjx0912 commentedon Jun 4, 2025
i have the same problem, .opencommit:
wjx0912 commentedon Jun 4, 2025
i create a file: %userprofile%/.opencommit_migrations
the oco work normal
di-sukharev commentedon Jun 8, 2025
a weird issue, please close if all ok now
Vincentqyw commentedon Jun 21, 2025
Same issue. This works!
yshngg commentedon Jun 23, 2025
The migration feature was implemented to ensure backward compatibility, but found a small gap in coverage. The migration script at
src/migrations/00_use_single_api_key_and_url.ts
doesn't exhaustively handle all providers from the OCO_AI_PROVIDER_ENUM defined insrc/commands/config.ts
.opencommit/src/migrations/00_use_single_api_key_and_url.ts
Lines 16 to 40 in c107078
opencommit/src/commands/config.ts
Lines 717 to 730 in c107078
This causes errors like
"Failed to apply migration 00_use_single_api_key_and_url..."
when users try to use providers that aren't handled in the migration code.yshngg commentedon Jun 23, 2025
Hi @di-sukharev , I'm willing to contribute to solving this issue but I'm confused 🤔 about which option to choose.
Here are potential solutions I could consider:
Could you share your thoughts?