vxcontrol/pentagi · warning
Flows.InvalidRequest
Flows.InvalidRequest
Error message
group field not found
What it means
GetFlows supports a 'group' query parameter that must name a column known to flowsSQLMappers. When the requested group field is not in the mapper whitelist, the service rejects the query with this Flows.InvalidRequest error instead of building an unsafe/unknown GROUP BY.
Source
Thrown at backend/pkg/server/services/flows.go:115
scope = func(db *gorm.DB) *gorm.DB {
return db
}
} else if slices.Contains(privs, "flows.view") {
scope = func(db *gorm.DB) *gorm.DB {
return db.Where("user_id = ?", uid)
}
} else {
logger.FromContext(c).Errorf("error filtering user role permissions: permission not found")
response.Error(c, response.ErrNotPermitted, nil)
return
}
query.Init("flows", flowsSQLMappers)
if query.Group != "" {
if _, ok := flowsSQLMappers[query.Group]; !ok {
logger.FromContext(c).Errorf("error finding flows grouped: group field not found")
response.Error(c, response.ErrFlowsInvalidRequest, errors.New("group field not found"))
return
}
var respGrouped flowsGrouped
if respGrouped.Total, err = query.QueryGrouped(s.db, &respGrouped.Grouped, scope); err != nil {
logger.FromContext(c).WithError(err).Errorf("error finding flows grouped")
response.Error(c, response.ErrInternal, err)
return
}
response.Success(c, http.StatusOK, respGrouped)
return
}
if resp.Total, err = query.Query(s.db, &resp.Flows, scope); err != nil {
logger.FromContext(c).WithError(err).Errorf("error finding flows")
response.Error(c, response.ErrInternal, err)
returnView on GitHub (pinned to ea665308ba)
Solutions
- Use a valid group field name listed in flowsSQLMappers (check pkg/server/services/flows.go for allowed keys).
- Fix casing/snake_case mismatches (e.g. group=type, not group=Type).
- Update the frontend dropdown/filter to emit only mapper-backed field names.
- If a new grouping field is genuinely needed, add it to flowsSQLMappers server-side.
Example fix
// before GET /flows?group=flowStatus // after GET /flows?group=status
Defensive patterns
Strategy: validation
Validate before calling
const ALLOWED_GROUPS = ['status','type','created_at']; // mirror flowsSQLMappers
if (group && !ALLOWED_GROUPS.includes(group)) {
throw new Error(`group field not found: ${group}`);
} Try / catch
try {
const flows = await getFlows({ group });
render(flows);
} catch (e) {
if (e.code === 'Flows.InvalidRequest' && /group field not found/.test(e.message)) {
setGroup(null); // fall back to ungrouped view
notify('Unsupported grouping; showing ungrouped results.');
} else { throw e; }
} Prevention
- Generate the groupable-field list from the backend mappers instead of hardcoding.
- Use snake_case names exactly as defined in flowsSQLMappers.
- Add an integration test per group field the UI exposes.
- On upgrade, diff mapper keys against frontend group options.
When it happens
Trigger: GET /flows?group=<field> where <field> is not one of the keys in flowsSQLMappers (typo, wrong casing, or a field that is not groupable, e.g. group=status_text when only group=status exists).
Common situations: Frontend sending a computed/alias column name instead of the raw mapper key; API version drift after mappers were renamed; hand-written integrations guessing field names; localized or camelCase names passed where the mapper uses snake_case.
Related errors
- Internal
- Knowledge.InvalidRequest
- Msglogs.InvalidRequest
- Assistantlogs.InvalidRequest
- Assistants.InvalidRequest
AI-assisted analysis of vxcontrol/pentagi@ea665308ba (2026-09-01).
Data as JSON: /api/errors/aebf2b02f2498e5a.
Report an issue: GitHub.