Open
Conversation
- Fix type assertion error for non-array response formats
- Handle truncated JSON chunks in chunked responses
- Add retry logic for incomplete JSON data
- Simplify data handling to avoid double escaping
- Disable debug output by default
Fixes the "cannot unmarshal number into Go value of type [][]interface{}"
error when parsing responses with mixed data types.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
The CLI debug flag was not being passed to the underlying batchexecute client, preventing users from seeing detailed API request/response information when using the -debug flag. Changes: - Add WithDebug option to batchexecute when debug flag is enabled - Ensure debug option is set for authentication retry attempts - Now -debug flag properly shows detailed API interactions This enables debugging of API issues like the sources listing problem. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
03eacf6 to
8238f17
Compare
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
This PR fixes critical JSON parsing errors in the
batchexecutepackage that were causing thenlm listcommand to fail with type assertion errors.Problem
The original code assumed all API responses would be in
[][]interface{}format, but Google's NotebookLM API sometimes returns responses with mixed data types (including numbers), causing this error:This issue particularly manifests when:
Root Cause Analysis
[][]interface{}fails when response contains non-array elementsSolution
interface{}for initial unmarshaling with proper type assertionTechnical Changes
1.
decodeResponse()Function2.
decodeChunkedResponse()Functionjson.Decoder.InputOffset()to find complete object boundaries3. Data Processing
Testing
✅ Fixed original error:
nlm listnow works with mixed-type responses✅ Unicode support: Properly handles Japanese/Chinese notebook titles
✅ Chunked responses: Handles truncated JSON chunks gracefully
✅ Performance: Eliminates unnecessary JSON re-encoding overhead
✅ Clean output: No debug noise in normal operation
Backward Compatibility
This change maintains full backward compatibility while making the JSON parsing significantly more robust against various response formats from the NotebookLM API.
Impact
This fix resolves a blocking issue preventing users from listing their notebooks when responses contain mixed data types or Unicode characters, which is common in international usage scenarios.
🤖 Generated with Claude Code