{"record":{"id":"f72654b00bb99d08","repo":"ory/kratos","slug":"could-not-parse-q-as-uuid-w","errorCode":null,"errorMessage":"could not parse %q as UUID: %w","messagePattern":"could not parse %q as UUID: %w","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"session/handler.go","lineNumber":1403,"sourceCode":"\n// parseManageSessionsIDs interprets a manage-sessions filter array as a list\n// of explicit UUIDs and rejects any input containing the wildcard token.\n// Callers that accept the wildcard must use parseManageSessionsIDsOrWildcard.\nfunc parseManageSessionsIDs(raw []string) ([]uuid.UUID, error) {\n\tif len(raw) == 0 {\n\t\treturn nil, errors.New(\"array must not be empty\")\n\t}\n\tif len(raw) > ManageSessionsMaxIDs {\n\t\treturn nil, fmt.Errorf(\"at most %d IDs may be provided per call\", ManageSessionsMaxIDs)\n\t}\n\tids := make([]uuid.UUID, 0, len(raw))\n\tfor _, s := range raw {\n\t\tif s == ManageSessionsAllToken {\n\t\t\treturn nil, errors.New(\"the wildcard '*' is not accepted here\")\n\t\t}\n\t\tid, err := uuid.FromString(s)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"could not parse %q as UUID: %w\", s, err)\n\t\t}\n\t\tids = append(ids, id)\n\t}\n\treturn ids, nil\n}\n\n// wildcardBatch runs a single chunked bulk-session operation and packages the\n// row count plus a `more` flag for the response. `more` is true when the call\n// reached the per-call batch limit, signaling that the caller should re-issue\n// the request to drain the rest.\n//\n// When the row count is an exact multiple of the batch size, `more` is set\n// even though no rows are left; the caller will issue one extra request that\n// returns `{processed: 0, more: false}`. This is intentional — distinguishing\n// \"exactly batch-size\" from \"batch-size and more\" would cost an extra DB\n// query on every call to save one round-trip in a rare edge case.\nfunc wildcardBatch(ctx context.Context, op func(context.Context, int) (int, error)) (*ManageSessionsResponse, error) {\n\tn, err := op(ctx, manageSessionsWildcardBatchSize)","sourceCodeStart":1385,"sourceCodeEnd":1421,"githubUrl":"https://github.com/ory/kratos/blob/b86338da04a040247a07f46100a86dcfb3875909/session/handler.go#L1385-L1421","documentation":"This error is raised when parsing a session identifier string into a UUID fails (uuid.FromString). The session handler accepts a list of raw session ID strings and must convert each into a strongly-typed uuid.UUID before further processing. It wraps the underlying uuid library error so the offending raw value is visible in the message.","triggerScenarios":"Calling the session list/management API path where session IDs (from flags, request parameters, or the wildcard-rejection loop in session/handler.go:1403) include a string that is not a valid RFC 4122 UUID, e.g. an email address, numeric ID, or truncated identifier.","commonSituations":"Developers pass session tokens, external user IDs, or database serial numbers instead of UUID session IDs; copy-pasting IDs with whitespace, quotes, or trailing newlines; older clients using non-UUID identifiers.","solutions":["Print the offending value from the message (%q) and correct it to a valid UUID session identifier.","Validate IDs before submission, e.g. with uuid.FromString or a regex for the 8-4-4-4-12 hex format.","Trim whitespace and strip quotes/braces from the value before passing it.","If you only have an identity or user ID, look up the associated session IDs first via the identities API."],"exampleFix":"// before\nmycli sessions get --sessions 12345\n// after\nmycli sessions get --sessions 5ba2e8a9-3f2e-4a1c-9d0e-7b6c5a4d3e2f","handlingStrategy":"validation","validationCode":"import \"github.com/gofrs/uuid\"\nfor _, s := range ids {\n    if _, err := uuid.FromString(strings.TrimSpace(s)); err != nil {\n        return fmt.Errorf(\"invalid session ID %q: %w\", s, err)\n    }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Treat session IDs as uuid.UUID types end-to-end instead of raw strings.","Trim and strip quotes from IDs parsed from CLI args or env vars.","Remember the wildcard '*' is rejected here; never pass it in this list."],"tags":["uuid","parsing","session-management","cli"],"backgroundTag":"invalid-identifier-format","analyzedSha":"b86338da04a040247a07f46100a86dcfb3875909","analyzedAt":"2026-09-07T15:58:15.934Z","contentChangedAt":"2026-09-07T15:58:15.934Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}