iflytek/astron-agent · error

name or app_ids param must have at least one

Error message

name or app_ids param must have at least one

What it means

newAppListReq requires at least one of the 'name' or 'app_ids' query parameters when listing apps; calling the list endpoint with neither returns this validation error. It prevents unbounded full-table app scans through the API.

Solutions

  1. Add ?name=<search> or ?app_ids=<comma-or-list-of-ids> to the request URL
  2. Fix the calling client to include the filter it intends (check request building code)
  3. If a full listing is legitimately needed, use a dedicated admin/list API instead of this filtered endpoint

Example fix

// before
GET /api/v1/apps
// after
GET /api/v1/apps?app_ids=1001,1002
// or
GET /api/v1/apps?name=myapp
Defensive patterns

Strategy: validation

Validate before calling

if name == "" && appIds == "" {
    return errors.New("either name or app_ids query parameter is required")
}
url := fmt.Sprintf("/api/v1/apps?app_ids=%s", url.QueryEscape(appIds))

Try / catch

resp, err := http.Get(listURL)
if err == nil && resp.StatusCode == http.StatusBadRequest {
    body, _ := io.ReadAll(resp.Body)
    if strings.Contains(string(body), "name or app_ids param must have at least one") {
        // add the missing filter and retry
    }
}

Prevention

When it happens

Trigger: GET app list/detail endpoint (handled by ListApp or DetailApp) called without both ?name= and ?app_ids= query parameters.

Common situations: Frontend/client sending an empty filter form; API migration dropping the old required query param; hand-written curl/Postman calls omitting filters; proxy stripping empty query parameters.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


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

Appendix: source

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

	"strings"

	"github.com/gin-gonic/gin"
)

type AppListReq struct {
	Name    string
	AppIds  []string
	DevId   int
	CloudId string
}

func newAppListReq(c *gin.Context) (*AppListReq, error) {
	name, _ := c.GetQuery("name")
	appIds, _ := c.GetQuery("app_ids")
	cloudId, _ := c.GetQuery("cloud_id")
	devId, _ := c.GetQuery("dev_id")
	if len(name) == 0 && len(appIds) == 0 {
		return nil, errors.New("name or app_ids param must have at least one")
	}

	req := &AppListReq{
		Name:    name,
		CloudId: cloudId,
	}

	if len(appIds) > 0 {
		req.AppIds = strings.Split(appIds, ",")
	}

	if len(devId) > 0 {
		devIdInt, err := strconv.Atoi(devId)
		if err != nil {
			return nil, err
		}
		req.DevId = devIdInt
	}

View on GitHub (pinned to 5e758547a8)