iflytek/astron-agent · error
request_id must not been empty
Error message
request_id must not been empty
What it means
newAddAppReq parses the JSON body of the add-app request and requires a non-empty RequestId; an empty request_id fails validation. The request id is used for idempotency/tracing of app-creation calls, so it must be supplied by the client.
Solutions
- Include a non-empty request_id (e.g. UUID) in the request JSON body
- Verify the JSON field name/case matches the AddAppReq struct binding tag (e.g. "request_id")
- Regenerate/update the client SDK or fixtures after API struct changes
Example fix
// before
{"app_name":"myapp","dev_id":3,"cloud_id":"c1"}
// after
{"request_id":"3f2c1a9e-8b4d-4e6f-9a01-77c2d5e8f910","app_name":"myapp","dev_id":3,"cloud_id":"c1"} Defensive patterns
Strategy: validation
Validate before calling
if req.RequestId == "" {
return errors.New("request_id is required")
}
body, _ := json.Marshal(req)
_ = body Try / catch
resp, err := http.Post(addAppURL, "application/json", bytes.NewReader(payload))
if err == nil && resp.StatusCode >= 400 {
body, _ := io.ReadAll(resp.Body)
if strings.Contains(string(body), "request_id must not been empty") {
payload.RequestId = uuid.NewString()
// rebuild and retry once
}
} Prevention
- Always generate a UUID request_id for every add-app call
- Validate required fields client-side before serializing the payload
- Match JSON key casing to the server struct binding tags
- Update client SDKs/fixtures when AddAppReq fields change
When it happens
Trigger: POST add-app endpoint (SaveApp handler) with a JSON body whose request_id field is absent, empty string, or with mismatched JSON field casing so it unmarshals to empty.
Common situations: Client generating request_id only on retries instead of always; JSON tags renamed after an API update so the client's old field name no longer maps; tests/fixtures omitting request_id; proxies re-serializing bodies and dropping fields.
Understand the failure class
Background: "must not be empty", "cannot be empty" — required-field validation errors across open-source libraries — this error's family across 41 libraries.
Related errors
- app_name must not been empty
- cloud_id must not been empty
- dev_id must been more than zero
- name or app_ids param must have at least one
- api_key must not been empty
AI-assisted analysis of iflytek/astron-agent@5e758547a8 (2026-09-12).
Data as JSON: /api/errors/0088f29d5a23e793.
Report an issue: GitHub.
Appendix: source
Thrown at core/tenant/internal/handler/req.go:73
CloudId string `json:"cloud_id"`
}
type AddAppReq struct {
RequestId string `json:"request_id"`
AppName string `json:"app_name"`
AppDesc string `json:"app_desc"`
DevId int64 `json:"dev_id"`
CloudId string `json:"cloud_id"`
}
func newAddAppReq(c *gin.Context) (*AddAppReq, error) {
req := &AddAppReq{}
err := c.BindJSON(req)
if err != nil {
return nil, err
}
if len(req.RequestId) == 0 {
return nil, errors.New("request_id must not been empty")
}
if len(req.AppName) == 0 {
return nil, errors.New("app_name must not been empty")
}
if req.DevId <= 0 {
return nil, errors.New("dev_id must been more than zero")
}
if len(req.CloudId) == 0 {
return nil, errors.New("cloud_id must not been empty")
}
if len(req.AppDesc) == 0 {
req.AppDesc = ""
}
return req, nil
}
type ModifyAppReq struct {
RequestId string `json:"request_id"`View on GitHub (pinned to 5e758547a8)