iflytek/astron-agent · warning

api_secret must not been empty

Error message

api_secret must not been empty

What it means

newVerifyAppAuthReq rejects the VerifyAppAuth request when req.ApiSecret is empty. Both api_key and api_secret are mandatory to verify app credentials, so a missing secret aborts parsing with this error.

Solutions

  1. Include api_secret in the request JSON
  2. Confirm the secret is loaded from config/env before the call
  3. Provision the app credential pair (key+secret) first via the tenant bootstrap flow

Example fix

// before
req := &VerifyAppAuthReq{ApiKey: "ak-123"}
// after
req := &VerifyAppAuthReq{ApiKey: "ak-123", ApiSecret: "s3cret"}
Defensive patterns

Strategy: validation

Validate before calling

if body.APIKey == "" || body.APISecret == "" { return errors.New("api_key and api_secret are both required") }

Prevention

When it happens

Trigger: VerifyAppAuth called with JSON body lacking api_secret or api_secret:""; tests hitting TestNewVerifyAppAuthReq_EmptySecret path.

Common situations: Secret not provisioned on the client side, env var for secret empty, secret field omitted after copying an api_key-only payload template.

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


AI-assisted analysis of iflytek/astron-agent@5e758547a8 (2026-09-12). Data as JSON: /api/errors/ea8e02451037e63b. Report an issue: GitHub.

Appendix: source

Thrown at core/tenant/internal/handler/req.go:215

	return req, nil
}

type VerifyAppAuthReq struct {
	ApiKey    string `json:"api_key"`
	ApiSecret string `json:"api_secret"`
}

func newVerifyAppAuthReq(c *gin.Context) (*VerifyAppAuthReq, error) {
	req := &VerifyAppAuthReq{}
	err := c.BindJSON(req)
	if err != nil {
		return nil, err
	}
	if len(req.ApiKey) == 0 {
		return nil, errors.New("api_key must not been empty")
	}
	if len(req.ApiSecret) == 0 {
		return nil, errors.New("api_secret must not been empty")
	}
	return req, nil
}

View on GitHub (pinned to 5e758547a8)