SigNoz/signoz · error · errors SigNozError
ErrCodeRoleInvalidInput
ErrCodeRoleInvalidInput
Error message
transactionGroups must be an array of {relation, objectGroup} objects What it means
Thrown by NewTransactionGroups when the JSON payload for transactionGroups cannot be unmarshalled into an array of {relation, objectGroup} objects. The data must be a JSON array where each element has a valid relation and objectGroup. It wraps the underlying json.Unmarshal failure on malformed structure.
Source
Thrown at pkg/types/authtypes/transaction.go:59
}
type TransactionWithAuthorization struct {
Transaction *Transaction
Authorized bool
}
func NewTransaction(relation Relation, object coretypes.Object) (*Transaction, error) {
if err := coretypes.ErrIfVerbNotValidForResource(relation.Verb, object.Resource); err != nil {
return nil, err
}
return &Transaction{ID: valuer.GenerateUUID(), Relation: relation, Object: object}, nil
}
func NewTransactionGroups(data []byte) (TransactionGroups, error) {
var rawGroups []rawTransactionGroup
if err := json.Unmarshal(data, &rawGroups); err != nil {
return nil, errors.New(errors.TypeInvalidInput, ErrCodeRoleInvalidInput, "transactionGroups must be an array of {relation, objectGroup} objects")
}
groups := make(TransactionGroups, 0, len(rawGroups))
for index, rawGroup := range rawGroups {
group, err := newTransactionGroup(rawGroup, index)
if err != nil {
return nil, err
}
groups = append(groups, group)
}
return groups, nil
}
func NewTransactionGroupsFromTransactions(transactions []coretypes.Transaction) TransactionGroups {
objectsByVerb := make(map[string][]*coretypes.Object)
for _, transaction := range transactions {View on GitHub (pinned to 5069bf80b0)
Solutions
- Verify the payload is a JSON array: [{"relation":"...","objectGroup":{...}}]
- Ensure each element has both relation and objectGroup present with correct types
- If reading from DB, check the stored column for truncated or legacy-format JSON
- Add unit test unmarshalling the exact payload you send
Example fix
// before
{"transactionGroups":{"relation":"reader"}}
// after
{"transactionGroups":[{"relation":"reader","objectGroup":{"...":{}}}]}
Defensive patterns
Strategy: validation
Validate before calling
func isValidTransactionGroups(data []byte) bool {
var raw []map[string]json.RawMessage
return json.Unmarshal(data, &raw) == nil
} Try / catch
if _, err := authtypes.NewTransactionGroups(body); err != nil { return http.StatusBadRequest } Prevention
- Validate array structure client-side before submit
- Keep a golden JSON fixture in tests for transactionGroups
When it happens
Trigger: Calling UnmarshalJSON/Scan on a Transaction-bearing type where transactionGroups is a JSON object instead of an array, an array of scalars, or elements missing/wrong-typed relation/objectGroup fields; also DB Scan of a corrupt column value.
Common situations: Hand-written JSON payloads in tests, API clients sending a single group object instead of an array, schema drift between stored JSON and the Go type after upgrades.
Related errors
AI-assisted analysis of SigNoz/signoz@5069bf80b0 (2026-08-28).
Data as JSON: /api/errors/43f92e1836b30d45.
Report an issue: GitHub.