{"record":{"id":"fe1a2b7f31a7f0ba","repo":"hashicorp/terraform","slug":"default-workspace-not-supported-you-can-create-a-n","errorCode":null,"errorMessage":"default workspace not supported\nYou can create a new workspace with the \"workspace new\" command.","messagePattern":"default workspace not supported\nYou can create a new workspace with the \"workspace new\" command\\.","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/backend/backend.go","lineNumber":28,"sourceCode":"import (\n\t\"errors\"\n\n\t\"github.com/zclconf/go-cty/cty\"\n\n\t\"github.com/hashicorp/terraform/internal/configs/configschema\"\n\t\"github.com/hashicorp/terraform/internal/states/statemgr\"\n\t\"github.com/hashicorp/terraform/internal/tfdiags\"\n)\n\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.","sourceCodeStart":10,"sourceCodeEnd":46,"githubUrl":"https://github.com/hashicorp/terraform/blob/d32a084675427f5ac3f7d2868578ef8b2c1dc525/internal/backend/backend.go#L10-L46","documentation":"A nested block type (NestedBlock) has a non-empty DeprecationMessage while Deprecated is false. DeprecationMessage is only meaningful as the human-readable explanation that accompanies Deprecated=true, so the schema is internally inconsistent. The check lives in Block.internalValidate and fires for each offending child block type.","triggerScenarios":"Defining a NestedBlock whose embedded Block sets DeprecationMessage: \"use foo_v2 instead\" but omits Deprecated: true. The validator iterates b.BlockTypes and, for each entry where !blockS.Deprecated && blockS.DeprecationMessage != \"\", appends this error.","commonSituations":"Provider author copies a deprecation block from another schema and forgets the Deprecated flag; refactoring that clears Deprecated but leaves the message; hand-written schema literals where the two fields drift apart.","solutions":["Set Deprecated: true on the offending nested block so the message takes effect.","Remove the DeprecationMessage string if the block is not actually deprecated.","Run the provider's schema unit test (calling schema.InternalValidate / InternalValidate) to confirm the error is gone."],"exampleFix":"// before\n\"old_block\": {\n  Nesting: configschema.NestingList,\n  DeprecationMessage: \"use new_block instead\",\n},\n// after\n\"old_block\": {\n  Nesting: configschema.NestingList,\n  Deprecated: true,\n  DeprecationMessage: \"use new_block instead\",\n},","handlingStrategy":"validation","validationCode":"// Ensure a nested block's deprecation fields agree before InternalValidate.\nfunc validateDeprecation(b *configschema.NestedBlock) error {\n    if b == nil { return nil }\n    if b.DeprecationMessage != \"\" && !b.Deprecated {\n        return fmt.Errorf(\"DeprecationMessage set without Deprecated=true\")\n    }\n    return nil\n}","typeGuard":"// hasConsistentDeprecation returns true when DeprecationMessage is empty OR Deprecated is set.\nfunc hasConsistentDeprecation(deprecated bool, msg string) bool {\n    return msg == \"\" || deprecated\n}","tryCatchPattern":null,"preventionTips":["Always set Deprecated: true whenever you write a DeprecationMessage on a block.","Add a unit test that calls schema.InternalValidate() for every provider schema.","When un-deprecating, clear both fields together."],"tags":["schema-validation","configschema","deprecation","provider-schema"],"backgroundTag":null,"analyzedSha":"d32a084675427f5ac3f7d2868578ef8b2c1dc525","analyzedAt":"2026-08-11T18:43:52.779Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}