{"record":{"id":"43e7c1d77bb6a760","repo":"hashicorp/terraform","slug":"q-cannot-be-lower-than-d-d","errorCode":null,"errorMessage":"%q cannot be lower than %d: %d","messagePattern":"%q cannot be lower than (.+?): (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/backend/remote-state/cos/backend.go","lineNumber":256,"sourceCode":"\t\t\t\tType:        schema.TypeString,\n\t\t\t\tOptional:    true,\n\t\t\t\tDefaultFunc: schema.EnvDefaultFunc(PROVIDER_CAM_ROLE_NAME, nil),\n\t\t\t\tDescription: \"The name of the CVM instance CAM role. It can be sourced from the `TENCENTCLOUD_CAM_ROLE_NAME` environment variable.\",\n\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)","sourceCodeStart":238,"sourceCodeEnd":274,"githubUrl":"https://github.com/hashicorp/terraform/blob/d32a084675427f5ac3f7d2868578ef8b2c1dc525/internal/backend/remote-state/cos/backend.go#L238-L274","documentation":"validateIntegerInRange emits this when a ranged integer attribute is below its minimum. Today the function backs assume_role.session_duration (0..43200 seconds). The error names the attribute (k), the minimum, and the supplied value.","triggerScenarios":"terraform init with assume_role.session_duration (or another ranged int) set below the schema minimum (e.g. negative or below 0 for session_duration).","commonSituations":"Mis-typed duration; assumed minutes instead of seconds; attempted to disable sessions with a negative number.","solutions":["Set session_duration to a value within the documented range (0..43200 seconds for assume_role).","Re-run terraform init."],"exampleFix":"// before\nassume_role {\n  session_duration = -1\n}\n\n// after\nassume_role {\n  session_duration = 7200\n}","handlingStrategy":"validation","validationCode":"// Validate an integer is within [min,max] before passing it to the schema.\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":["Read the schema docs: assume_role.session_duration is seconds in [0,43200].","Lint backend blocks in CI to catch out-of-range integers.","Don't confuse seconds with minutes/hours when filling durations.","Prefer env-var defaults (TENCENTCLOUD_ASSUME_ROLE_SESSION_DURATION) consistent across team."],"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"}