Fix: Deserialization error for todo items missing priority field#1
Open
arcalumis wants to merge 1 commit into
Open
Fix: Deserialization error for todo items missing priority field#1arcalumis wants to merge 1 commit into
arcalumis wants to merge 1 commit into
Conversation
When running cc-enhanced, users encountered the error: "Error: missing field `priority` at line 6 column 3" This occurred because some older todo files in ~/.claude/todos/ were created before the priority field was added to the TodoItem struct, causing serde deserialization to fail. The fix makes the priority field optional using serde's default attribute, providing a fallback value of Medium priority for backward compatibility with existing todo files. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
Open
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
priorityat line 6 column 3" that occurs when running cc-enhancedProblem
When running cc-enhanced, users encountered the error:
This happened because:
~/.claude/todos/were created before thepriorityfield was added to theTodoItemstructTodoManager::parse_todo_file()when callingserde_json::from_str(&content)?Root Cause Analysis
The error occurs in
src/features/todos/data.rsat line 147:When parsing todo files like
/Users/baud/.claude/todos/5ab42a40-9260-406f-8b72-20b8610aa918-agent-5ab42a40-9260-406f-8b72-20b8610aa918.json, which contain:[ { "content": "Check current voice mode configuration", "status": "completed", "id": "1" }, { "content": "List available TTS voices", "status": "completed", "id": "2" } ]The deserializer fails because the
TodoItemstruct requires apriorityfield that doesn't exist in these legacy files.Solution
#[serde(default = "default_priority")]attribute to thepriorityfield in theTodoItemstructdefault_priority()function that returnsTodoPriority::Mediumas the fallback valueTesting
Files Changed
src/features/todos/data.rs- Made priority field optional with default value🤖 Generated with Claude Code