iflytek/astron-agent · error
dev_id must been more than zero
Error message
dev_id must been more than zero
What it means
newAddAppReq requires DevId to be a positive integer; a dev_id of zero or negative fails validation with this message. The dev id identifies the owning developer/tenant and must reference an existing positive id.
Solutions
- Send a positive integer dev_id in the request body
- Ensure the dev_id is fetched/initialized before calling (check the client's tenant/dev context)
- Verify the JSON key matches the struct binding tag so the value actually binds (non-numeric strings bind to 0)
Example fix
// before
{"request_id":"r1","app_name":"myapp","dev_id":0,"cloud_id":"c1"}
// after
{"request_id":"r1","app_name":"myapp","dev_id":42,"cloud_id":"c1"} Defensive patterns
Strategy: validation
Validate before calling
if req.DevId <= 0 {
return errors.New("dev_id must be a positive integer")
} Try / catch
if err := submitAddApp(req); err != nil {
if strings.Contains(err.Error(), "dev_id must been more than zero") {
return fmt.Errorf("dev_id not set or invalid; initialize developer context first: %w", err)
}
return err
} Prevention
- Initialize the dev/tenant context before calling add-app
- Guard against zero-value ints in payload builders (require explicit assignment)
- Ensure JSON dev_id is numeric, not a string that binds to 0
- Cover dev_id validation in integration tests
When it happens
Trigger: POST add-app (SaveApp) with dev_id missing (0 zero-value), negative, or non-numeric input that binds to the zero value of the numeric field.
Common situations: Client not yet knowing its dev_id (uninitialized config); JSON field name mismatch causing zero binding; upstream code passing an unset int variable; tests with placeholder dev_id values.
Understand the failure class
Background: "value must be between 0 and 1" / "out of range" / "must not be negative" errors: fixing range-validation failures across open-source libraries — this error's family across 42 libraries.
Related errors
- app_name must not been empty
- cloud_id must not been empty
- 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/fb41d25bdccf22b6.
Report an issue: GitHub.
Appendix: source
Thrown at core/tenant/internal/handler/req.go:79
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"`
AppId string `json:"app_id"`
AppName string `json:"app_name"`
CloudId string `json:"cloud_id"`
AppDesc string `json:"app_desc"`
}
View on GitHub (pinned to 5e758547a8)