{"record":{"id":"bc9d2b9a28a53d81","repo":"benbjohnson/litestream","slug":"invalid-filename-in-path-s-w","errorCode":null,"errorMessage":"invalid filename in path %s: %w","messagePattern":"invalid filename in path (.+?): %w","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"nats/replica_client.go","lineNumber":276,"sourceCode":"\t\tobjPath = strings.TrimPrefix(objPath, c.Path+\"/\")\n\t}\n\n\t// Expected format: \"ltx/<level>/<minTXID>-<maxTXID>.ltx\"\n\tparts := strings.Split(objPath, \"/\")\n\tif len(parts) < 3 || parts[0] != \"ltx\" {\n\t\treturn 0, 0, 0, fmt.Errorf(\"invalid ltx path: %s\", objPath)\n\t}\n\n\t// Parse level\n\tif level, err = strconv.Atoi(parts[1]); err != nil {\n\t\treturn 0, 0, 0, fmt.Errorf(\"invalid level in path %s: %w\", objPath, err)\n\t}\n\n\t// Parse filename (minTXID-maxTXID.ltx)\n\tfilename := parts[2]\n\tminTXIDVal, maxTXIDVal, err := ltx.ParseFilename(filename)\n\tif err != nil {\n\t\treturn 0, 0, 0, fmt.Errorf(\"invalid filename in path %s: %w\", objPath, err)\n\t}\n\n\treturn level, minTXIDVal, maxTXIDVal, nil\n}\n\n// LTXFiles returns an iterator of all LTX files on the replica for a given level.\n// NATS always uses accurate timestamps from headers since they're included in LIST operations at zero cost.\n// The useMetadata parameter is ignored.\nfunc (c *ReplicaClient) LTXFiles(ctx context.Context, level int, seek ltx.TXID, useMetadata bool) (ltx.FileIterator, error) {\n\tif err := c.Init(ctx); err != nil {\n\t\treturn nil, err\n\t}\n\n\t// List all objects in the store\n\tinternal.OperationTotalCounterVec.WithLabelValues(ReplicaClientType, \"LIST\").Inc()\n\tobjectList, err := c.objectStore.List(ctx)\n\tif err != nil {\n\t\t// NATS returns \"no objects found\" when bucket is empty, treat as empty list","sourceCodeStart":258,"sourceCodeEnd":294,"githubUrl":"https://github.com/benbjohnson/litestream/blob/4ed7a308f6271ebfd2b0a6e4b70b03011a37e4a3/nats/replica_client.go#L258-L294","documentation":"parseLTXPath could not parse the filename component of a NATS object path as an LTX range. The path matched ltx/<level>/ but the third segment is not a valid <minTXID>-<maxTXID>.ltx pair (ltx.ParseFilename failed), so a listed object in the store does not follow the LTX naming convention.","triggerScenarios":"Thrown at nats/replica_client.go:276 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Remove or rename non-LTX objects in the NATS object store under the replica path","Check for manually uploaded or leftover files with malformed names"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"4ed7a308f6271ebfd2b0a6e4b70b03011a37e4a3","analyzedAt":"2026-09-06T18:29:25.564Z","contentChangedAt":"2026-09-06T18:29:25.564Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}