AlexxIT/go2rtc · error
${allocResponse.Msg}
Error message
${allocResponse.Msg} What it means
Tuya Cloud API GetStreamUrl guard: the /v1.0/devices/{id}/stream/actions/allocate call transported fine, but the AllocateResponse reports Success=false and its server-provided Msg becomes the error. The cloud refused to allocate a WebRTC stream for the device — permissions, plan limits, or device state per Msg.
Solutions
- Act on the appended Msg (e.g. device offline, no permission)
- Verify client_id/client_secret and the device belongs to the account
- Retry after the cloud/device recovers; allocation can be transiently unavailable
Defensive patterns
Strategy: try-catch
When it happens
Trigger: Thrown at pkg/tuya/cloud_api.go:150 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of AlexxIT/go2rtc@c245815e75 (2026-09-07).
Data as JSON: /api/errors/2a7e8b45aa808ad0.
Report an issue: GitHub.
Appendix: source
Thrown at pkg/tuya/cloud_api.go:150
url := fmt.Sprintf("https://%s/v1.0/devices/%s/stream/actions/allocate", c.baseUrl, c.deviceId)
request := &AllocateRequest{
Type: streamType,
}
body, err := c.request("POST", url, request)
if err != nil {
return "", err
}
var allocResponse AllocateResponse
err = json.Unmarshal(body, &allocResponse)
if err != nil {
return "", err
}
if !allocResponse.Success {
return "", errors.New(allocResponse.Msg)
}
return allocResponse.Result.URL, nil
}
func (c *TuyaCloudApiClient) initToken() (err error) {
if c.refreshingToken {
return nil
}
now := time.Now().Unix()
if (c.expireTime - 60) > now {
return nil
}
c.refreshingToken = true
url := fmt.Sprintf("https://%s/v1.0/token?grant_type=1", c.baseUrl)View on GitHub (pinned to c245815e75)