Quick Summary
When the API endpoint is misconfigured (e.g., wrong api_base URL), the API returns an HTML error page, but the error message is cryptic:
failed to unmarshal response: invalid character '<' looking for beginning of value
This doesn't help users identify that their api_base URL is wrong.
Environment & Tools
- PicoClaw Version: latest (main branch)
- Go Version: (e.g., go 1.22)
- AI Model & Provider: (e.g., GPT-4o via OpenAI / DeepSeek via SiliconFlow)
- Operating System: (e.g., Ubuntu 22.04 / macOS / Android Termux)
- Channels: (e.g., Discord, Telegram, Feishu, ...)
📸 Steps to Reproduce
- Configure a model with an incorrect
api_base URL (e.g., missing /v1 path)
- Run
picoclaw agent -m "hello"
- Observe the unhelpful error message
❌ Actual Behavior
Generic JSON parse error that doesn't mention the root cause.
✅ Expected Behavior
The error message should clearly indicate:
- The API returned non-JSON content
- The Content-Type of the response
- Suggest checking the
api_base URL configuration
💬 Additional Context
Proposed Fix
Add Content-Type header validation and HTML detection before attempting JSON unmarshal, with clear error messages guiding users to check their api_base URL.
Quick Summary
When the API endpoint is misconfigured (e.g., wrong
api_baseURL), the API returns an HTML error page, but the error message is cryptic:failed to unmarshal response: invalid character '<' looking for beginning of value
This doesn't help users identify that their
api_baseURL is wrong.Environment & Tools
📸 Steps to Reproduce
api_baseURL (e.g., missing/v1path)picoclaw agent -m "hello"❌ Actual Behavior
Generic JSON parse error that doesn't mention the root cause.
✅ Expected Behavior
The error message should clearly indicate:
api_baseURL configuration💬 Additional Context
Proposed Fix
Add Content-Type header validation and HTML detection before attempting JSON unmarshal, with clear error messages guiding users to check their
api_baseURL.