iflytek/astron-agent · error
cloud_id must not been empty
Error message
cloud_id must not been empty
What it means
newAddAppReq requires a non-empty CloudId; an add-app request without cloud_id fails validation. The cloud id determines the cloud environment the app is registered in and must be provided by the caller.
Solutions
- Include a non-empty cloud_id in the request JSON body
- Set the default/selected cloud environment in the client before calling add-app
- Verify the JSON key matches the AddAppReq binding tag (e.g. "cloud_id")
Example fix
// before
{"request_id":"r1","app_name":"myapp","dev_id":42}
// after
{"request_id":"r1","app_name":"myapp","dev_id":42,"cloud_id":"cloud-01"} Defensive patterns
Strategy: validation
Validate before calling
if req.CloudId == "" {
return errors.New("cloud_id is required")
} Try / catch
if err := submitAddApp(req); err != nil {
if strings.Contains(err.Error(), "cloud_id must not been empty") {
return fmt.Errorf("select a cloud environment before creating the app: %w", err)
}
return err
} Prevention
- Resolve the target cloud environment before calling add-app
- Configure a default cloud_id in client settings for single-cloud deployments
- Keep payload field names aligned with server binding tags after API revisions
- Validate all required fields (request_id, app_name, dev_id, cloud_id) in one client-side pre-check
When it happens
Trigger: POST add-app (SaveApp) with JSON body missing cloud_id, empty string, or a key case mismatch with the binding tag so it binds to empty.
Common situations: Multi-cloud clients with cloud selection not yet performed in the UI; scripts with hardcoded payloads missing the newer cloud_id field added in an API revision; environment-specific config omitting the default cloud id.
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
- dev_id must been more than zero
- request_id must not been empty
- 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/c1d11ed85ce512fa.
Report an issue: GitHub.
Appendix: source
Thrown at core/tenant/internal/handler/req.go:82
}
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"`
AppId string `json:"app_id"`
AppName string `json:"app_name"`
CloudId string `json:"cloud_id"`
AppDesc string `json:"app_desc"`
}
func newModifyAppReq(c *gin.Context) (*ModifyAppReq, error) {
req := &ModifyAppReq{}
err := c.BindJSON(req)View on GitHub (pinned to 5e758547a8)