|
1 | 1 | { |
2 | 2 | "projectName": "docsrs-mcp", |
3 | | - "lastUpdated": "2025-08-16", |
| 3 | + "lastUpdated": "2025-08-18", |
4 | 4 | "purpose": "Track errors, solutions, and lessons learned during development", |
5 | 5 | "categories": { |
6 | 6 | "errorSolutions": { |
|
542 | 542 | "relatedFiles": ["src/docsrs_mcp/mcp_tools.py"], |
543 | 543 | "codeExample": "# Standard pattern for all tools:\nasync def tool_function(crate_name: str, ...):\n # Always attempt ingestion first\n db_path = await ingest_crate(crate_name, session)\n if not db_path:\n raise ValueError(f'Failed to ingest crate: {crate_name}')\n \n # Proceed with tool logic\n return process_data(db_path, ...)", |
544 | 544 | "debuggingTechnique": "Review all tool implementations to verify consistent auto-ingestion pattern usage" |
| 545 | + }, |
| 546 | + { |
| 547 | + "error": "Variable Shadowing Bug - All Crates Returning 'unwind' as Name", |
| 548 | + "rootCause": "Variable shadowing in get_crate_summary function at line 1103 of app.py. The crate name variable was being overwritten by module names in a loop processing crate modules. The last module processed ('unwind') would replace the actual crate name.", |
| 549 | + "solution": "Rename loop variable from 'name' to 'module_name' to prevent shadowing the crate name variable when unpacking tuples in the module processing loop.", |
| 550 | + "context": "All crates returning 'unwind' as their name in MCP mode, breaking crate identification and search functionality", |
| 551 | + "implementation": [ |
| 552 | + "Changed loop variable from 'name' to 'module_name' in tuple unpacking", |
| 553 | + "Preserved original crate name variable throughout function execution", |
| 554 | + "Fixed variable scope isolation to prevent unintended overwrites" |
| 555 | + ], |
| 556 | + "lesson": "Always check for variable shadowing in loops, especially when unpacking tuples. Loop variables can accidentally overwrite outer scope variables if named identically.", |
| 557 | + "pattern": "Use descriptive, scope-specific variable names in loops to avoid shadowing: use 'module_name' instead of 'name' when processing modules", |
| 558 | + "dateEncountered": "2025-08-18", |
| 559 | + "relatedFiles": ["src/docsrs_mcp/app.py"], |
| 560 | + "affectedLines": ["app.py:1103"], |
| 561 | + "codeExample": "# Before (variable shadowing):\nfor name, path in modules:\n # 'name' overwrites the crate name variable\n \n# After (no shadowing):\nfor module_name, path in modules:\n # 'module_name' doesn't conflict with crate name", |
| 562 | + "debuggingTechnique": "Test with multiple different crates to verify each returns its correct name rather than the last processed module name", |
| 563 | + "additionalNotes": [ |
| 564 | + "The hardcoded crate_id = 1 was also fixed but was NOT the cause of this specific bug", |
| 565 | + "Old cached databases may need to be deleted and re-ingested if they contain corrupted data from previous buggy runs", |
| 566 | + "This bug only affected MCP mode because the variable shadowing occurred in the get_crate_summary function" |
| 567 | + ], |
| 568 | + "warningFlags": "Variable shadowing, loop variable naming, tuple unpacking scope issues" |
545 | 569 | } |
546 | 570 | ] |
547 | 571 | }, |
|
1741 | 1765 | "debuggingTechnique": "Check ingestion counts in database before running comparisons to identify incomplete data", |
1742 | 1766 | "implementationDetails": "Added MIN_ITEMS_THRESHOLD check in version_diff.py using existing validation utilities from validation.py to provide actionable error messages explaining the issue", |
1743 | 1767 | "impact": "Prevents misleading '0 changes' results and provides clear error messages when comparison data is insufficient" |
| 1768 | + }, |
| 1769 | + { |
| 1770 | + "error": "getCrateSummary returning 'unwind' as name for all crates in MCP mode", |
| 1771 | + "context": "All crates return 'unwind' as the name field in getCrateSummary responses when using MCP mode, despite database containing correct crate names", |
| 1772 | + "investigation": { |
| 1773 | + "suspectedCause": "tools_to_fix dictionary in FastMCP schema override using camelCase operation_ids instead of snake_case tool names", |
| 1774 | + "attemptedFix": "Changed tool names from camelCase (getCrateSummary) to snake_case (get_crate_summary) in tools_to_fix dictionary", |
| 1775 | + "result": "Bug persists after schema override fix - root cause appears deeper than initially suspected" |
| 1776 | + }, |
| 1777 | + "currentStatus": "Unresolved - database contains correct data, issue appears to be in response generation or serialization layer", |
| 1778 | + "debuggingFindings": [ |
| 1779 | + "Database queries return correct crate names when tested directly", |
| 1780 | + "Issue specific to MCP mode - REST mode returns correct names", |
| 1781 | + "Schema override modification did not resolve the issue", |
| 1782 | + "Problem likely in FastMCP response serialization or field mapping" |
| 1783 | + ], |
| 1784 | + "nextSteps": [ |
| 1785 | + "Investigate FastMCP response serialization logic", |
| 1786 | + "Check field mapping between database results and MCP responses", |
| 1787 | + "Test with simplified response models to isolate the issue", |
| 1788 | + "Compare MCP vs REST response generation pathways" |
| 1789 | + ], |
| 1790 | + "dateEncountered": "2025-08-16", |
| 1791 | + "relatedFiles": ["src/docsrs_mcp/mcp_server.py", "src/docsrs_mcp/mcp_tools.py", "src/docsrs_mcp/models.py"], |
| 1792 | + "impact": "All MCP clients receive incorrect crate names, affecting user experience and tool reliability" |
1744 | 1793 | } |
1745 | 1794 | ] |
1746 | 1795 | }, |
|
0 commit comments