{"record":{"id":"6526f28e3fdcfdd6","repo":"JuliusBrussee/caveman","slug":"cachebench-time-scale-must-be-greater-than-zero-a","errorCode":null,"errorMessage":"cachebench: time scale must be greater than zero and at most 1000","messagePattern":"cachebench: time scale must be greater than zero and at most 1000","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cacheengine/cachebench/replay.go","lineNumber":366,"sourceCode":"\tTarget    *Target\n\tTimeScale float64\n\tNow       func() time.Time\n\tSleep     func(context.Context, time.Duration) error\n}\n\n// ValidateReplay performs zero-network trace, schedule, and budget preflight.\nfunc ValidateReplay(records []TraceRecord, limits ReplayLimits, timeScale float64) (ReplayPreflight, error) {\n\tif len(records) == 0 {\n\t\treturn ReplayPreflight{}, errors.New(\"cachebench: replay trace is empty\")\n\t}\n\tif limits.MaxRequests <= 0 || limits.MaxDeclaredBilledTokens <= 0 || limits.MaxGap <= 0 || limits.MaxScheduleDrift <= 0 || limits.MaxConcurrency <= 0 || limits.MaxConcurrency > 1024 {\n\t\treturn ReplayPreflight{}, errors.New(\"cachebench: positive replay request, token, gap, schedule-drift, and concurrency limits required; concurrency cannot exceed 1024\")\n\t}\n\tif len(records) > limits.MaxRequests {\n\t\treturn ReplayPreflight{}, fmt.Errorf(\"cachebench: replay population %d exceeds request limit %d\", len(records), limits.MaxRequests)\n\t}\n\tif timeScale <= 0 || math.IsNaN(timeScale) || math.IsInf(timeScale, 0) || timeScale > 1000 {\n\t\treturn ReplayPreflight{}, errors.New(\"cachebench: time scale must be greater than zero and at most 1000\")\n\t}\n\tseen := make(map[string]bool, len(records))\n\ttiming := map[string]bool{}\n\ttokens := map[string]bool{}\n\tvar previous time.Time\n\tvar declaredInput, declaredOutput, worstCase, scheduled int64\n\tfor index, record := range records {\n\t\tif seen[record.RequestID] {\n\t\t\treturn ReplayPreflight{}, fmt.Errorf(\"cachebench: duplicate replay request %q\", record.RequestID)\n\t\t}\n\t\tseen[record.RequestID] = true\n\t\tif record.Schema != TraceSchema {\n\t\t\treturn ReplayPreflight{}, fmt.Errorf(\"cachebench: replay request %q needs %s billed-token metadata\", record.RequestID, TraceSchema)\n\t\t}\n\t\tif _, err := record.NativeRequest(); err != nil {\n\t\t\treturn ReplayPreflight{}, fmt.Errorf(\"cachebench: replay request %d: %w\", index, err)\n\t\t}\n\t\tat, err := time.Parse(time.RFC3339Nano, record.At)","sourceCodeStart":348,"sourceCodeEnd":384,"githubUrl":"https://github.com/JuliusBrussee/caveman/blob/766dce6b1394ebb56a3090748d5a0240a5aefb36/cacheengine/cachebench/replay.go#L348-L384","documentation":"Raised in ValidateReplay: the timeScale argument is not in (0, 1000]. Zero or negative scale would invert/negate timing, and beyond 1000x the compressed schedule becomes meaningless for faithful timing replay.","triggerScenarios":"Thrown at cacheengine/cachebench/replay.go:366 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass 1 for real-time faithful replay","Choose a scale in (0, 1000] that still respects provider rate limits","Check for an uninitialized TimeScale field defaulting to 0 on the runner"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"766dce6b1394ebb56a3090748d5a0240a5aefb36","analyzedAt":"2026-08-18T03:14:35.516Z","contentChangedAt":"2026-08-18T03:14:35.516Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}