{"record":{"id":"1a411fdbd13d1c6f","repo":"benbjohnson/litestream","slug":"invalid-txid-format","errorCode":null,"errorMessage":"invalid txid format","messagePattern":"invalid txid format","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/litestream/main.go","lineNumber":2172,"sourceCode":"\treturn s\n}\n\n// txidVar allows the flag package to parse index flags as hex-formatted TXIDs\ntype txidVar ltx.TXID\n\n// Ensure type implements interface.\nvar _ flag.Value = (*txidVar)(nil)\n\n// String returns an 8-character hexadecimal value.\nfunc (v *txidVar) String() string {\n\treturn ltx.TXID(*v).String()\n}\n\n// Set parses s into an integer from a hexadecimal value.\nfunc (v *txidVar) Set(s string) error {\n\ttxID, err := ltx.ParseTXID(s)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"invalid txid format\")\n\t}\n\t*v = txidVar(txID)\n\treturn nil\n}\n\n// levelAll is a sentinel value indicating all compaction levels should be shown.\nconst levelAll = -1\n\n// levelVar allows the flag package to parse compaction level flags.\n// Accepts integers 0-9 or \"all\" for all levels.\ntype levelVar int\n\nvar _ flag.Value = (*levelVar)(nil)\n\nfunc (v *levelVar) String() string {\n\tif *v == levelAll {\n\t\treturn \"all\"\n\t}","sourceCodeStart":2154,"sourceCodeEnd":2190,"githubUrl":"https://github.com/benbjohnson/litestream/blob/4ed7a308f6271ebfd2b0a6e4b70b03011a37e4a3/cmd/litestream/main.go#L2154-L2190","documentation":"Error from txidVar.Set, the flag.Value used for -txid command-line flags, when ltx.ParseTXID cannot parse the argument. Fires when a user passes a flag value that is not a valid 8-character hexadecimal TXID (e.g. 'abc' or '123z').","triggerScenarios":"Running `litestream ltx -txid <value>` where value is not a valid hexadecimal TXID (e.g. decimal digits like `123456789` are fine only if hex-valid; values with non-hex characters like `0x` prefix, spaces, or `abcg`).","commonSituations":"Copy-pasting a TXID with a `0x` prefix from a debugger; passing a decimal TXID string from another tool; including whitespace or quoting artifacts.","solutions":["Pass the TXID as bare uppercase or lowercase hexadecimal, e.g. `0000000000000042`.","Strip any `0x` prefix or surrounding quotes/whitespace.","Get the exact TXID string from `litestream ltx` output and reuse it verbatim."],"exampleFix":"// before\nlitestream ltx -txid 0x42\n// after\nlitestream ltx -txid 0000000000000042","handlingStrategy":"validation","validationCode":"// Validate hex TXID before passing to the CLI\nif _, err := strconv.ParseUint(strings.TrimPrefix(txid, \"0x\"), 16, 64); err != nil {\n    return fmt.Errorf(\"not a hex txid: %q\", txid)\n}","typeGuard":null,"tryCatchPattern":"if err := cmd.Run(); err != nil {\n    if strings.Contains(err.Error(), \"invalid txid format\") {\n        // normalize to bare hex and retry\n    }\n}","preventionTips":["Strip 0x prefixes and whitespace before passing TXIDs on the command line.","Copy TXIDs directly from `litestream ltx` output without transformation."],"tags":["cli","txid","hex","flag-parsing"],"backgroundTag":"invalid-argument-format","analyzedSha":"4ed7a308f6271ebfd2b0a6e4b70b03011a37e4a3","analyzedAt":"2026-09-06T18:29:25.564Z","contentChangedAt":"2026-09-06T18:29:25.564Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}