{"record":{"id":"80556bda2b76e222","repo":"SigNoz/signoz","slug":"span-attribute-mapping-invalid-input","errorCode":"span_attribute_mapping_invalid_input","errorMessage":"group id is not a valid uuid","messagePattern":"group id is not a valid uuid","errorType":"error_code","errorClass":"errors.base","httpStatus":400,"severity":"error","filePath":"pkg/modules/spanmapper/implspanmapper/handler.go","lineNumber":311,"sourceCode":"\t}\n\n\tgroups := spantypes.NewSpanMapperGroupsWithMappersFromPostable(orgID, req.Groups)\n\tout, collectorLogs, err := h.module.TestMappers(ctx, orgID, req.Spans, groups)\n\tif err != nil {\n\t\trender.Error(rw, err)\n\t\treturn\n\t}\n\n\trender.Success(rw, http.StatusOK, &spantypes.GettableSpanMapperTest{Spans: out, CollectorLogs: collectorLogs})\n}\n\n// groupIDFromPath extracts and validates the {id} or {groupId} path variable.\nfunc groupIDFromPath(r *http.Request) (valuer.UUID, error) {\n\tvars := mux.Vars(r)\n\traw := vars[\"groupId\"]\n\tid, err := valuer.NewUUID(raw)\n\tif err != nil {\n\t\treturn valuer.UUID{}, errors.Wrapf(err, errors.TypeInvalidInput, spantypes.ErrCodeMappingInvalidInput, \"group id is not a valid uuid\")\n\t}\n\treturn id, nil\n}\n\n// mapperIDFromPath extracts and validates the {mapperId} path variable.\nfunc mapperIDFromPath(r *http.Request) (valuer.UUID, error) {\n\traw := mux.Vars(r)[\"mapperId\"]\n\tid, err := valuer.NewUUID(raw)\n\tif err != nil {\n\t\treturn valuer.UUID{}, errors.Wrapf(err, errors.TypeInvalidInput, spantypes.ErrCodeMappingInvalidInput, \"mapper id is not a valid uuid\")\n\t}\n\treturn id, nil\n}\n","sourceCodeStart":293,"sourceCodeEnd":325,"githubUrl":"https://github.com/SigNoz/signoz/blob/5069bf80b08f1f00d7e014eccc09902f9871004f/pkg/modules/spanmapper/implspanmapper/handler.go#L293-L325","documentation":"groupIDFromPath helper rejects the {groupId} path variable because valuer.NewUUID could not parse it. Raised by all mapper group endpoints (update/delete group, list/create/update/delete mapper).","triggerScenarios":"Any span-attribute-mapper route carrying a non-UUID {groupId}, e.g. PUT /groups/default or POST /groups/abc/mappers.","commonSituations":"Calling mapper endpoints before creating the group (using a placeholder id), or using a group name instead of the returned groupId.","solutions":["Create the group first and use its returned uuid","List groups to resolve name → groupId","Client-side UUID validation on all mapper route ids"],"exampleFix":"// before\nPOST /api/v1/groups/my-group/mappers\n// after\nPOST /api/v1/groups/123e4567-e89b-12d3-a456-426614174000/mappers","handlingStrategy":"validation","validationCode":"const group = await api.createGroup(payload); // or listGroups()\nassertUUID(group.uuid);\nawait api.createMapper(group.uuid, mapper);","typeGuard":"const isUUID = (s: unknown): s is string => typeof s === 'string' && /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(s);","tryCatchPattern":null,"preventionTips":["Always create/look up the group before composing mapper routes","Centralize id validation in the API client"],"tags":["uuid","path-parameter","span-mapper","invalid-input"],"backgroundTag":"invalid-uuid-path-parameter","analyzedSha":"5069bf80b08f1f00d7e014eccc09902f9871004f","analyzedAt":"2026-08-28T06:22:12.824Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}