{"record":{"id":"c1f8557badca62ad","repo":"SigNoz/signoz","slug":"errors-codeinternal-c1f855","errorCode":"errors.CodeInternal","errorMessage":"failed to scan transactionGroups","messagePattern":"failed to scan transactionGroups","errorType":"error_code","errorClass":null,"httpStatus":500,"severity":"error","filePath":"pkg/types/authtypes/transaction.go","lineNumber":137,"sourceCode":"func (groups *TransactionGroups) Scan(value any) error {\n\tif value == nil {\n\t\t*groups = make(TransactionGroups, 0)\n\t\treturn nil\n\t}\n\n\tvar data []byte\n\tswitch typed := value.(type) {\n\tcase string:\n\t\tdata = []byte(typed)\n\tcase []byte:\n\t\tdata = typed\n\tdefault:\n\t\treturn errors.Newf(errors.TypeInternal, errors.CodeInternal, \"unsupported type %T for transaction groups\", value)\n\t}\n\n\tparsed, err := NewTransactionGroups(data)\n\tif err != nil {\n\t\treturn errors.Wrap(err, errors.TypeInternal, errors.CodeInternal, \"failed to scan transactionGroups\")\n\t}\n\n\t*groups = parsed\n\treturn nil\n}\n\nfunc (transaction *Transaction) UnmarshalJSON(data []byte) error {\n\tvar shadow = struct {\n\t\tRelation Relation\n\t\tObject   coretypes.Object\n\t}{}\n\n\terr := json.Unmarshal(data, &shadow)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\ttxn, err := NewTransaction(shadow.Relation, shadow.Object)","sourceCodeStart":119,"sourceCodeEnd":155,"githubUrl":"https://github.com/SigNoz/signoz/blob/5069bf80b08f1f00d7e014eccc09902f9871004f/pkg/types/authtypes/transaction.go#L119-L155","documentation":"TransactionGroups.Scan implements sql.Scanner for reading the column from the database. After converting the driver value to bytes it calls NewTransactionGroups to parse/validate the JSON; a parse or validation failure is wrapped as an internal error with 'failed to scan transactionGroups'.","triggerScenarios":"Reading a row whose transaction groups column contains malformed JSON or data that violates NewTransactionGroups validation (wrong shape, unknown fields with strict parsing, null where an object is required).","commonSituations":"Corrupted rows written by an older version or manual SQL updates; schema/format drift after an upgrade changes TransactionGroups validation rules; truncated column values.","solutions":["Inspect the offending row's column and fix or NULL-out invalid JSON via SQL","Check for format changes in NewTransactionGroups after upgrades and migrate stored data","If the column is legitimately empty, ensure it stores valid empty-group JSON or NULL handled by the driver"],"exampleFix":"// before (row contains)\n{\"groups\": [ {\"id\": 1, }\n\n// after\n{\"groups\": [{\"id\": \"...\", \"role_grants\": []}]}","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"if err := rows.Scan(&groups, ...); err != nil {\n    if strings.Contains(err.Error(), \"failed to scan transactionGroups\") {\n        // quarantine row, alert ops, skip processing\n        log.Error(\"corrupt transactionGroups column\", \"id\", rowID)\n        continue\n    }\n    return err\n}","preventionTips":["Never hand-edit groups columns with raw SQL","Add migration checks after upgrades that alter TransactionGroups format"],"tags":["database","sql-scanner","json","corruption"],"backgroundTag":"db-row-parse-failed","analyzedSha":"5069bf80b08f1f00d7e014eccc09902f9871004f","analyzedAt":"2026-08-28T06:22:12.824Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}