{"record":{"id":"86e61d0d388ad0d1","repo":"JuliusBrussee/caveman","slug":"tenantkey-safe-month-and-request-id-are-required","errorCode":null,"errorMessage":"tenantkey: safe month and request id are required","messagePattern":"tenantkey: safe month and request id are required","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"shared/platform/tenantkey/tenantkey.go","lineNumber":38,"sourceCode":"func MonthlySpend(organizationID, projectID, month string) (string, error) {\n\tprefix, err := projectPrefix(\"spend\", organizationID, projectID)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tif !safePart(month) {\n\t\treturn \"\", errors.New(\"tenantkey: safe month is required\")\n\t}\n\treturn prefix + \":\" + month, nil\n}\n\n// MonthlySpendEvent returns idempotency-marker key for one spend event.\nfunc MonthlySpendEvent(organizationID, projectID, month, requestID string) (string, error) {\n\tprefix, err := projectPrefix(\"spend-event\", organizationID, projectID)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tif !safePart(month) || !safePart(requestID) {\n\t\treturn \"\", errors.New(\"tenantkey: safe month and request id are required\")\n\t}\n\treturn prefix + \":\" + month + \":\" + requestID, nil\n}\n\nfunc projectPrefix(namespace, organizationID, projectID string) (string, error) {\n\tif !safePart(organizationID) || !safePart(projectID) {\n\t\treturn \"\", errors.New(\"tenantkey: safe organization and project scope are required\")\n\t}\n\treturn \"cave:\" + namespace + \":\" + organizationID + \":\" + projectID, nil\n}\n\nfunc safePart(value string) bool {\n\tvalue = strings.TrimSpace(value)\n\treturn value != \"\" && !strings.ContainsAny(value, \":\\r\\n\\x00\")\n}\n","sourceCodeStart":20,"sourceCodeEnd":54,"githubUrl":"https://github.com/JuliusBrussee/caveman/blob/27d5a3981a347890211bb1bf2439e5c821a63bc9/shared/platform/tenantkey/tenantkey.go#L20-L54","documentation":"Error \"tenantkey: safe month and request id are required\" thrown in JuliusBrussee/caveman.","triggerScenarios":"Thrown at shared/platform/tenantkey/tenantkey.go:38 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Provide a safe month and request id."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"27d5a3981a347890211bb1bf2439e5c821a63bc9","analyzedAt":"2026-08-15T09:26:11.751Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}