Summary
The CodexLens models page can receive the wrong response shape from /api/codexlens/models, which causes the frontend to crash with:
TypeError: m.map is not a function
I reproduced this on:
Claude-Code-Workflow 7.3.8
codexlens-search v0.8.1
Reproduction
- Start the dashboard:
- Open the CodexLens page in the dashboard.
- The frontend expects
/api/codexlens/models to return:
{"success": true, "models": [ ... ]}
- In the failing case, the backend returns the legacy text output from
codexlens-search list-models, so models is a string instead of an array.
- The React page then crashes because it does
.map() on that value.
Expected
/api/codexlens/models should always return an array for models
/api/codexlens/models/download should propagate tool failures instead of wrapping them as success: true
Actual
Two related problems showed up:
/api/codexlens/models can return legacy text output instead of JSON array data.
/api/codexlens/models/download can return success: true even when the underlying tool output is:
{"status":"failed","model":"..."}
Likely Cause
There appears to be a legacy CodexLens route implementation still active in ccw/dist/core/routes/codexlens-routes.js:
- the models list handler calls
spawnCli('codexlens-search', ['list-models']) instead of requesting JSON output
- the download handler treats any zero exit code as success, even if the parsed JSON payload reports a failed download status
This causes a frontend/backend contract mismatch with the newer CodexLens page code, which expects a normalized array response.
Impact
/codexlens page can crash on load
- download status can be falsely reported as success
- debugging becomes confusing because the backend response shape is inconsistent
A minimal fix would be:
- switch the models route to
list-models --json
- normalize the parsed response to an array
- make the download route inspect the parsed JSON status instead of only checking the process exit code
Summary
The CodexLens models page can receive the wrong response shape from
/api/codexlens/models, which causes the frontend to crash with:I reproduced this on:
Claude-Code-Workflow 7.3.8codexlens-search v0.8.1Reproduction
/api/codexlens/modelsto return:{"success": true, "models": [ ... ]}codexlens-search list-models, somodelsis a string instead of an array..map()on that value.Expected
/api/codexlens/modelsshould always return an array formodels/api/codexlens/models/downloadshould propagate tool failures instead of wrapping them assuccess: trueActual
Two related problems showed up:
/api/codexlens/modelscan return legacy text output instead of JSON array data./api/codexlens/models/downloadcan returnsuccess: trueeven when the underlying tool output is:{"status":"failed","model":"..."}Likely Cause
There appears to be a legacy CodexLens route implementation still active in
ccw/dist/core/routes/codexlens-routes.js:spawnCli('codexlens-search', ['list-models'])instead of requesting JSON outputThis causes a frontend/backend contract mismatch with the newer CodexLens page code, which expects a normalized array response.
Impact
/codexlenspage can crash on loadA minimal fix would be:
list-models --json