{"record":{"id":"a6800872dceeded4","repo":"hashicorp/terraform","slug":"q-cannot-be-higher-than-d-d","errorCode":null,"errorMessage":"%q cannot be higher than %d: %d","messagePattern":"%q cannot be higher than (.+?): (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/backend/remote-state/cos/backend.go","lineNumber":260,"sourceCode":"\t\t\t},\n\t\t},\n\t}\n\n\tresult := &Backend{Backend: s}\n\tresult.Backend.ConfigureFunc = result.configure\n\n\treturn result\n}\n\nfunc validateIntegerInRange(min, max int64) schema.SchemaValidateFunc {\n\treturn func(v interface{}, k string) (ws []string, errors []error) {\n\t\tvalue := int64(v.(int))\n\t\tif value < min {\n\t\t\terrors = append(errors, fmt.Errorf(\n\t\t\t\t\"%q cannot be lower than %d: %d\", k, min, value))\n\t\t}\n\t\tif value > max {\n\t\t\terrors = append(errors, fmt.Errorf(\n\t\t\t\t\"%q cannot be higher than %d: %d\", k, max, value))\n\t\t}\n\t\treturn\n\t}\n}\n\n// configure init cos client\nfunc (b *Backend) configure(ctx context.Context) error {\n\tif b.cosClient != nil {\n\t\treturn nil\n\t}\n\n\tb.cosContext = ctx\n\tdata := schema.FromContextBackendConfig(b.cosContext)\n\n\tb.region = data.Get(\"region\").(string)\n\tb.bucket = data.Get(\"bucket\").(string)\n\tb.prefix = data.Get(\"prefix\").(string)","sourceCodeStart":242,"sourceCodeEnd":278,"githubUrl":"https://github.com/hashicorp/terraform/blob/d32a084675427f5ac3f7d2868578ef8b2c1dc525/internal/backend/remote-state/cos/backend.go#L242-L278","documentation":"Companion of 191 from the same validateIntegerInRange: emits when the ranged integer exceeds its maximum. For assume_role.session_duration the cap is 43200 seconds (12h).","triggerScenarios":"terraform init with assume_role.session_duration > 43200.","commonSituations":"User enters seconds assuming a larger unit; intends 12h+; typos an extra digit.","solutions":["Lower session_duration to <= 43200 seconds.","Re-run terraform init."],"exampleFix":"// before\nassume_role {\n  session_duration = 86400\n}\n\n// after\nassume_role {\n  session_duration = 43200\n}","handlingStrategy":"validation","validationCode":"// Reuse the same validator as 191.\nfunc validateIntInRange(min, max int64, v int) error {\n    if int64(v) < min {\n        return fmt.Errorf(\"value %d cannot be lower than %d\", v, min)\n    }\n    if int64(v) > max {\n        return fmt.Errorf(\"value %d cannot be higher than %d\", v, max)\n    }\n    return nil\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Cap session_duration at 43200 (12h); use shorter-lived sessions where possible.","Lint backend blocks in CI.","Document the unit (seconds) next to every duration field.","Use CAM session policies instead of stretching duration."],"tags":["cos","tencent-cloud","config-validation","assume-role","backend"],"backgroundTag":null,"analyzedSha":"d32a084675427f5ac3f7d2868578ef8b2c1dc525","analyzedAt":"2026-08-11T18:43:52.779Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}