opencode icon indicating copy to clipboard operation
opencode copied to clipboard

add new mode results in ENAMETOOLONG: name too long, open fatal

Open carlesoctav opened this issue 1 year ago • 7 comments

continuation of #846 here's the full logs

INFO  2025-07-10T23:46:11 +124ms service=app cwd=/home/carlesoctav/dotfiles/.config/opencode creating
INFO  2025-07-10T23:46:11 +2ms service=default version=0.2.24 args= opencode
INFO  2025-07-10T23:46:11 +1ms service=app cwd=/home/carlesoctav/dotfiles/.config/opencode creating
INFO  2025-07-10T23:46:11 +7ms service=app git=/home/carlesoctav/dotfiles git
INFO  2025-07-10T23:46:11 +0ms service=app git=/home/carlesoctav/dotfiles git
INFO  2025-07-10T23:46:11 +1ms service=app name=config registering service
INFO  2025-07-10T23:46:11 +2ms service=bus type=storage.write subscribing
INFO  2025-07-10T23:46:11 +0ms service=app name=bus registering service
INFO  2025-07-10T23:46:11 +0ms service=format init
INFO  2025-07-10T23:46:11 +0ms service=bus type=file.edited subscribing
INFO  2025-07-10T23:46:11 +0ms service=config.hooks init
INFO  2025-07-10T23:46:11 +0ms service=bus type=file.edited subscribing
INFO  2025-07-10T23:46:11 +0ms service=bus type=session.idle subscribing
INFO  2025-07-10T23:46:11 +0ms service=app name=lsp registering service
INFO  2025-07-10T23:46:11 +0ms service=app name=file.watcher registering service
INFO  2025-07-10T23:46:11 +2ms service=app name=provider registering service
INFO  2025-07-10T23:46:11 +1ms service=app name=config registering service
INFO  2025-07-10T23:46:11 +8ms service=config $schema=https://opencode.ai/config.json mode=[object Object] loaded
INFO  2025-07-10T23:46:11 +0ms service=config $schema=https://opencode.ai/config.json mode=[object Object] loaded
INFO  2025-07-10T23:46:11 +4ms service=models.dev refreshing
INFO  2025-07-10T23:46:11 +0ms service=provider init
INFO  2025-07-10T23:46:11 +4ms service=provider providerID=anthropic found
INFO  2025-07-10T23:46:11 +1ms service=provider providerID=github-copilot found
INFO  2025-07-10T23:46:11 +12ms service=default cmd=/home/carlesoctav/.cache/opencode/tui/tui-gakaqvms. tui
INFO  2025-07-10T23:46:11 +1ms service=app name=mode registering service
INFO  2025-07-10T23:46:11 +1ms service=app name=lsp shutdown
INFO  2025-07-10T23:46:11 +0ms service=app name=file.watcher shutdown
ERROR 2025-07-10T23:46:11 +5ms service=default name=Error message=ENAMETOOLONG: name too long, open fatal

carlesoctav avatar Jul 10 '25 23:07 carlesoctav

maybe if this relevant, i put my config on ~/dotfiles/.config/opencode and symlink this to ~/.config/opencode

carlesoctav avatar Jul 11 '25 00:07 carlesoctav

https://opencode.ai/s/hz0dru11

carlesoctav avatar Jul 11 '25 02:07 carlesoctav

same problem +1

jaysean1 avatar Jul 11 '25 05:07 jaysean1

I also encountered the same problem. When I configured a custom command, I got an error when starting opencode.:

`### Planner Mode Process You are now in Planner Mode. don't hold back, give it your all. Your process is as follows:

Step 0: Deep Analysis & Clarification

• Deeply analyze the user's request and the existing codebase. Do not rush. • If the implementation path is 100% clear, SKIP questions.Do not rush/ego,if you are not sure, ask the user for clarification. • Formulate up to THREE high-impact clarifying questions to resolve all ambiguities. Pause and await answers.

Step 1: Ultrathink Scoping

  • Note: Before drafting the concrete action plan—and after incorporating the user's answers—perform a deep analysis to ensure you fully understand the user's requirements and the existing code structure. Do not rush into the plan! • Perform an "Ultrathink + scan" to map out every impacted file, function, class, test, and dependency. Before you start drafting the detailed action plan— and after incorporating any clarifications from the user— conduct a deep analysis to ensure you fully understand both the requirements and the existing code structure:
    • Use ls (or an equivalent command) to inspect the project directory tree.
    • Read the README and dependency manifests (e.g., package.json, requirements.txt) to gain a high-level understanding of the project.
    • Open and review the source files most relevant to the user's request to validate your understanding and identify all touch-points.

Step 2: Draft Action Plan

• Create a comprehensive, multi-phase action plan. • Start with a one-sentence OVERVIEW. • Structure the plan into TASKS -> SUBTASKS. • Each SUBTASK must be a single, atomic action (e.g., "create file x", "add function y to z.py"). Do not combine multiple actions. • Prefix every TASK/SUBTASK with a status emoji.

  • Use ☐ for pending tasks, ☐ with bold text for in-progress tasks, and ☒ with ~~strikethrough~~ for completed tasks. Never invent other symbols.

Step 3: Approval Gate

• Present the full plan. • Define the emoji legend. • Request explicit agree to begin execution. or continue to edit the plan.

Step 4: Iterative Execution & Live Status Updates

• Once approved, execute the plan SUBTASK by SUBTASK. • After completing each SUBTASK: 1. RE-PRESENT the entire plan, updating the completed item's icon: ☐ To-Do ☐ In Progress ☒ ~~Done~~ ❌ Failed 2. Announce what was just finished and what is next. • Continue this loop until all tasks are ☒.

Step 5: Final Summary

• After the final task is complete, deliver a concise SUMMARY including: • A high-level overview of changes made. • Links to key commits or diffs. • Final test results. • Any recommended follow-up actions.

Adhere to this process strictly. `

{ "$schema": "https://opencode.ai/config.json", "mode": { "planner": { "prompt": "{file:./prompts/planner.txt}", "tools": { "read": true, "grep": true, "glob": true, "list": true, "patch": true, "todowrite": true, "todoread": true, "webfetch": true, "bash": false, "edit": false, "write": false } } } }

INFO 2025-07-11T04:59:41 +24ms service=app cwd=/Users/qiansui/.config/opencode creating INFO 2025-07-11T04:59:41 +0ms service=default version=0.2.27 args= opencode INFO 2025-07-11T04:59:41 +0ms service=app cwd=/Users/qiansui/.config/opencode creating INFO 2025-07-11T04:59:41 +1ms service=app git INFO 2025-07-11T04:59:41 +0ms service=app git INFO 2025-07-11T04:59:41 +1ms service=bus type=storage.write subscribing INFO 2025-07-11T04:59:41 +0ms service=app name=bus registering service INFO 2025-07-11T04:59:41 +1ms service=format init INFO 2025-07-11T04:59:41 +0ms service=bus type=file.edited subscribing INFO 2025-07-11T04:59:41 +0ms service=config.hooks init INFO 2025-07-11T04:59:41 +0ms service=bus type=file.edited subscribing INFO 2025-07-11T04:59:41 +0ms service=bus type=session.idle subscribing INFO 2025-07-11T04:59:41 +0ms service=app name=lsp registering service INFO 2025-07-11T04:59:41 +0ms service=app name=provider registering service INFO 2025-07-11T04:59:41 +0ms service=app name=config registering service INFO 2025-07-11T04:59:41 +0ms service=app name=config registering service INFO 2025-07-11T04:59:41 +1ms service=config $schema=https://opencode.ai/config.json mode=[object Object] loaded INFO 2025-07-11T04:59:41 +1ms service=config $schema=https://opencode.ai/config.json mode=[object Object] loaded INFO 2025-07-11T04:59:41 +0ms service=models.dev refreshing INFO 2025-07-11T04:59:41 +0ms service=provider init INFO 2025-07-11T04:59:41 +2ms service=provider providerID=google found INFO 2025-07-11T04:59:41 +0ms service=provider providerID=openrouter found INFO 2025-07-11T04:59:41 +0ms service=provider providerID=deepseek found INFO 2025-07-11T04:59:41 +0ms service=provider providerID=anthropic found INFO 2025-07-11T04:59:41 +55ms service=default cmd=/Users/qiansui/.cache/opencode/tui/tui-dh3235x4. tui INFO 2025-07-11T04:59:41 +0ms service=app name=mode registering service INFO 2025-07-11T04:59:41 +0ms service=app name=lsp shutdown ERROR 2025-07-11T04:59:41 +1ms service=default name=Error message=ENAMETOOLONG: name too long, open fatal

jaysean1 avatar Jul 11 '25 05:07 jaysean1

Works for me if I put full path without {file: } part, eg

...
"prompt": "/Users/user/.config/opencode/prompts/custom.txt",
...

Looks like {file: } reads file and puts prompt in place AND then it tries to use it as file path

Alexxzz avatar Jul 11 '25 11:07 Alexxzz

Ah yes, no need to read "prompt" as file path here because config.ts already expands it if it sees {file: ... } https://github.com/sst/opencode/blob/04769d8a26e7d047d4dbde00ce089a4c69d9aff1/packages/opencode/src/session/mode.ts#L56C1-L56C74

Alexxzz avatar Jul 11 '25 11:07 Alexxzz

/Users/user/.config/opencode/prompts/custom.txt"

thx,I changed the usage path and it succeeded!!!

jaysean1 avatar Jul 11 '25 12:07 jaysean1