Skip to content

worktree: handle_worktree_command silently falls back to default config on parse error #4701

@bug-ops

Description

@bug-ops

Description

handle_worktree_command in src/commands/worktree.rs calls Config::load().unwrap_or_default(). When the user passes a config with only a [worktree] section (e.g. a minimal test config), the TOML parse fails because Config has non-defaulted required fields (agent, llm, etc.). unwrap_or_default() silently falls back to the default config, which has worktree.enabled = false, causing the confusing error:

Error: worktree subsystem is disabled. Set `worktree.enabled = true` in your config.

even though the user did set enabled = true.

Reproduction Steps

  1. Create /tmp/wt.toml with only [worktree]\nenabled = true\n
  2. Run zeph --config /tmp/wt.toml worktree list
  3. Observe: error says disabled despite enabled = true

Expected Behavior

A config parse error should be propagated to the user with a clear message, or the worktree command should accept a config file with only the worktree section (all other fields default).

Actual Behavior

unwrap_or_default() silently swallows the parse error and falls back to default config with worktree.enabled = false.

Fix

Replace Config::load(&config_file).unwrap_or_default() with a proper error-propagating call and surface the parse error to the user.

Environment

  • Version: 0.21.3 (88145ab)
  • Features: default

Logs / Evidence

[FAIL] config.parse (0 ms) failed to parse config file: TOML parse error at line 1, column 1
1 | [worktree]

Metadata

Metadata

Assignees

Labels

P3Research — medium-high complexitybugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions