{"record":{"id":"8301d350210bf59c","repo":"hashicorp/nomad","slug":"origin-must-be-start-or-end","errorCode":null,"errorMessage":"origin must be start or end","messagePattern":"origin must be start or end","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"client/fs_endpoint.go","lineNumber":37,"sourceCode":"\t\"time\"\n\n\tmetrics \"github.com/hashicorp/go-metrics/compat\"\n\t\"github.com/hashicorp/go-msgpack/v2/codec\"\n\t\"github.com/hpcloud/tail/watch\"\n\n\t\"github.com/hashicorp/nomad/acl\"\n\t\"github.com/hashicorp/nomad/client/allocdir\"\n\tsframer \"github.com/hashicorp/nomad/client/lib/streamframer\"\n\tcstructs \"github.com/hashicorp/nomad/client/structs\"\n\t\"github.com/hashicorp/nomad/nomad/structs\"\n)\n\nvar (\n\tallocIDNotPresentErr = fmt.Errorf(\"must provide a valid alloc id\")\n\tpathNotPresentErr    = fmt.Errorf(\"must provide a file path\")\n\ttaskNotPresentErr    = fmt.Errorf(\"must provide task name\")\n\tlogTypeNotPresentErr = fmt.Errorf(\"must provide log type (stdout/stderr)\")\n\tinvalidOrigin        = fmt.Errorf(\"origin must be start or end\")\n)\n\nconst (\n\t// streamFramesBuffer is the number of stream frames that will be buffered\n\t// before back pressure is applied on the stream framer.\n\tstreamFramesBuffer = 32\n\n\t// streamFrameSize is the maximum number of bytes to send in a single frame\n\tstreamFrameSize = 64 * 1024\n\n\t// streamHeartbeatRate is the rate at which a heartbeat will occur to detect\n\t// a closed connection without sending any additional data\n\tstreamHeartbeatRate = 1 * time.Second\n\n\t// streamBatchWindow is the window in which file content is batched before\n\t// being flushed if the frame size has not been hit.\n\tstreamBatchWindow = 200 * time.Millisecond\n","sourceCodeStart":19,"sourceCodeEnd":55,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/client/fs_endpoint.go#L19-L55","documentation":"invalidOrigin is a sentinel error for file-stream and log requests whose Origin field is not \"start\" or \"end\". Origin controls whether streaming begins at the beginning of the file or at the end (follow mode). Invalid values are rejected with HTTP 400 before any file access.","triggerScenarios":"Calling stream, logs, Stream, or Logs with req.Origin set to anything other than \"start\", \"end\", or empty (empty is defaulted to \"start\") — e.g. origin=middle or origin=top.","commonSituations":"Hand-rolled HTTP clients guessing valid values ('beginning', 'tail'); UI passing localized or free-text offset options; casing mistakes like Origin=\"Start\".","solutions":["Use only \"start\" or \"end\" (lowercase) for the origin parameter, or omit it entirely to get the default","For tail/follow behavior use origin=end; for full history use origin=start","Validate/normalize the value in your client before sending: strings.ToLower + whitelist check"],"exampleFix":"// before\nGET /v1/client/fs/logs/<alloc>?task=web&type=stdout&origin=beginning\n// after\nGET /v1/client/fs/logs/<alloc>?task=web&type=stdout&origin=start","handlingStrategy":"validation","validationCode":"if origin == \"\" {\n    origin = \"start\"\n}\nif origin != \"start\" && origin != \"end\" {\n    return fmt.Errorf(\"origin must be \\\"start\\\" or \\\"end\\\", got %q\", origin)\n}","typeGuard":"func isValidOrigin(o string) bool {\n    return o == \"\" || o == \"start\" || o == \"end\"\n}","tryCatchPattern":"r, err := client.AllocFS().Logs(alloc, task, \"\", false, \"stdout\", origin, 0, ctx.Done(), nil)\nif err != nil && strings.Contains(err.Error(), \"origin must be start or end\") {\n    log.Printf(\"invalid origin %q, using \\\"start\\\"\", origin)\n    return client.AllocFS().Logs(alloc, task, \"\", false, \"stdout\", \"start\", 0, ctx.Done(), nil)\n}","preventionTips":["Expose only two UI options (Beginning / Follow) mapped to \"start\"/\"end\"","Normalize and lowercase user input before setting the origin parameter","Default to empty origin (server defaults to \"start\") rather than inventing values"],"tags":["api","validation","logs","streaming"],"backgroundTag":"invalid-argument-value","analyzedSha":"482b49bf1aec006f089bcfc7e632d8f6ac303e5e","analyzedAt":"2026-09-04T07:54:14.808Z","contentChangedAt":"2026-09-04T07:54:14.808Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}