{"record":{"id":"36a249e32c021fc5","repo":"hashicorp/terraform","slug":"workspaces-not-supported","errorCode":null,"errorMessage":"workspaces not supported","messagePattern":"workspaces not supported","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/backend/backend.go","lineNumber":37,"sourceCode":"\n// DefaultStateName is the name of the default, initial state that every\n// backend must have. This state cannot be deleted.\nconst DefaultStateName = \"default\"\n\nvar (\n\t// ErrDefaultWorkspaceNotSupported is returned when an operation does not\n\t// support using the default workspace, but requires a named workspace to\n\t// be selected.\n\tErrDefaultWorkspaceNotSupported = errors.New(\"default workspace not supported\\n\" +\n\t\t\"You can create a new workspace with the \\\"workspace new\\\" command.\")\n\n\t// ErrWorkspacesNotSupported is an error returned when a caller attempts\n\t// to perform an operation on a workspace other than \"default\" for a\n\t// backend that doesn't support multiple workspaces.\n\t//\n\t// The caller can detect this to do special fallback behavior or produce\n\t// a specific, helpful error message.\n\tErrWorkspacesNotSupported = errors.New(\"workspaces not supported\")\n)\n\n// InitFn is used to initialize a new backend.\ntype InitFn func() Backend\n\n// Backend is the minimal interface that must be implemented to enable Terraform.\ntype Backend interface {\n\t// ConfigSchema returns a description of the expected configuration\n\t// structure for the receiving backend.\n\t//\n\t// This method does not have any side-effects for the backend and can\n\t// be safely used before configuring.\n\tConfigSchema() *configschema.Block\n\n\t// PrepareConfig checks the validity of the values in the given\n\t// configuration, and inserts any missing defaults, assuming that its\n\t// structure has already been validated per the schema returned by\n\t// ConfigSchema.","sourceCodeStart":19,"sourceCodeEnd":55,"githubUrl":"https://github.com/hashicorp/terraform/blob/d32a084675427f5ac3f7d2868578ef8b2c1dc525/internal/backend/backend.go#L19-L55","documentation":"A NestedBlock has a negative MinItems or MaxItems. Counts represent block occurrence limits and cannot be negative. Note the message says 'greater than zero' but the code only rejects values < 0; zero (meaning unset/unbounded) is allowed.","triggerScenarios":"Setting MinItems: -1 or MaxItems: -1 on a NestedBlock, often from an arithmetic expression or a default constant that underflows. The guard at internal_validate.go:64 is `blockS.MinItems < 0 || blockS.MaxItems < 0`.","commonSituations":"Computing MinItems/MaxItems from a subtraction that goes negative; porting a schema where -1 was a sentinel for 'unlimited' in another system; typos in generated schema code.","solutions":["Clamp MinItems and MaxItems to >= 0; use 0 to mean 'no limit'.","If you intended 'at least one', set MinItems: 1 (only valid in NestingList/NestingSet/NestingSingle).","Re-run InternalValidate in the provider test suite to confirm."],"exampleFix":"// before\nMinItems: required - 2, // can go negative\nMaxItems: -1,\n// after\nMinItems: max(0, required-2),\nMaxItems: 0, // 0 = unbounded","handlingStrategy":"validation","validationCode":"// Reject negative counts before constructing the schema.\nfunc validCounts(min, max int) bool {\n    return min >= 0 && max >= 0\n}","typeGuard":"func nonNegativeCounts(min, max int) bool { return min >= 0 && max >= 0 }","tryCatchPattern":null,"preventionTips":["Treat MinItems/MaxItems as unsigned counts; never use -1 as a sentinel.","Compute counts with max(0, expr) to avoid underflow.","Use 0 for MaxItems to mean 'unbounded'."],"tags":["schema-validation","configschema","minitems","maxitems","provider-schema"],"backgroundTag":null,"analyzedSha":"d32a084675427f5ac3f7d2868578ef8b2c1dc525","analyzedAt":"2026-08-11T18:43:52.779Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}