vxcontrol/pentagi · error
Assistantlogs.InvalidRequest
Assistantlogs.InvalidRequest
Error message
group field not found
What it means
GetAssistantlogs validates the `group` query parameter against the assistantlogsSQLMappers whitelist before running a grouped aggregation query. If the requested group field is not a recognized column alias, the request is rejected as Assistantlogs.InvalidRequest with the message 'group field not found'. This prevents arbitrary or misspelled fields from being interpolated into the GROUP BY SQL clause.
Source
Thrown at backend/pkg/server/services/assistantlogs.go:99
}
} else if slices.Contains(privs, "assistantlogs.view") {
scope = func(db *gorm.DB) *gorm.DB {
return db.
Joins("INNER JOIN flows f ON f.id = flow_id").
Where("f.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("assistantlogs", assistantlogsSQLMappers)
if query.Group != "" {
if _, ok := assistantlogsSQLMappers[query.Group]; !ok {
logger.FromContext(c).Errorf("error finding assistantlogs grouped: group field not found")
response.Error(c, response.ErrAssistantlogsInvalidRequest, errors.New("group field not found"))
return
}
var respGrouped assistantlogsGrouped
if respGrouped.Total, err = query.QueryGrouped(s.db, &respGrouped.Grouped, scope); err != nil {
logger.FromContext(c).WithError(err).Errorf("error finding assistantlogs grouped")
response.Error(c, response.ErrInternal, err)
return
}
response.Success(c, http.StatusOK, respGrouped)
return
}
if resp.Total, err = query.Query(s.db, &resp.AssistantLogs, scope); err != nil {
logger.FromContext(c).WithError(err).Errorf("error finding assistantlogs")
response.Error(c, response.ErrInternal, err)
returnView on GitHub (pinned to ea665308ba)
Solutions
- Inspect the assistantlogsSQLMappers map in backend/pkg/server/services/assistantlogs.go and use one of its exact keys as the group value
- Check the REST/Swagger docs for the list of allowed group fields for the assistantlogs endpoint
- Remove the group parameter entirely to fetch ungrouped results
- If the field genuinely should be groupable, add it to assistantlogsSQLMappers (and the underlying SQL mapper) in a code change
Example fix
// before GET /api/v1/assistantlogs?group=flow_type // after GET /api/v1/assistantlogs?group=type (a key present in assistantlogsSQLMappers)
Defensive patterns
Strategy: validation
Validate before calling
const allowedGroups = ["type","flow","status"]; // keys of assistantlogsSQLMappers
function isValidGroup(g?: string): boolean {
return !g || allowedGroups.includes(g);
}
if (!isValidGroup(group)) throw new Error(`invalid group field: ${group}`); Type guard
function isAssistantlogsGroup(g: string): g is typeof allowedGroups[number] {
return (allowedGroups as string[]).includes(g);
} Try / catch
try {
const res = await api.get('/assistantlogs', { params: { group } });
} catch (e) {
if (e.response?.data?.code === 'Assistantlogs.InvalidRequest') {
// fall back to ungrouped listing
return api.get('/assistantlogs');
}
throw e;
} Prevention
- Derive the group param from a constant list shared with the API docs, never free text
- Validate query params with zod before issuing the request
- Add an integration test per groupable field
When it happens
Trigger: A GET /assistantlogs request that includes a `group=<field>` query parameter whose value is not a key in assistantlogsSQLMappers (e.g. group=Type vs group=type, or a field that does not exist).
Common situations: Clients passing snake_case DB column names instead of the documented camelCase aliases; API version drift after a rename of a groupable field; copy-pasted grouping code between endpoints with different mapper sets; hand-built dashboard queries.
Related errors
- Assistants.InvalidRequest
- Containers.InvalidRequest
- Internal
- Agentlogs.InvalidRequest
- ErrToolcallsInvalidRequest
AI-assisted analysis of vxcontrol/pentagi@ea665308ba (2026-09-01).
Data as JSON: /api/errors/442620f809bc496b.
Report an issue: GitHub.