hashicorp/terraform · error
default workspace not supported You can create a new…
Error message
default workspace not supported You can create a new workspace with the "workspace new" command.
What it means
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.
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.
Example fix
// before
"old_block": {
Nesting: configschema.NestingList,
DeprecationMessage: "use new_block instead",
},
// after
"old_block": {
Nesting: configschema.NestingList,
Deprecated: true,
DeprecationMessage: "use new_block instead",
}, Defensive patterns
Strategy: validation
Validate before calling
// Ensure a nested block's deprecation fields agree before InternalValidate.
func validateDeprecation(b *configschema.NestedBlock) error {
if b == nil { return nil }
if b.DeprecationMessage != "" && !b.Deprecated {
return fmt.Errorf("DeprecationMessage set without Deprecated=true")
}
return nil
} Type guard
// hasConsistentDeprecation returns true when DeprecationMessage is empty OR Deprecated is set.
func hasConsistentDeprecation(deprecated bool, msg string) bool {
return msg == "" || deprecated
} Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
AI-assisted analysis of hashicorp/terraform@d32a084675 (2026-08-11).
Data as JSON: /api/errors/fe1a2b7f31a7f0ba.
Report an issue: GitHub.
Appendix: source
Thrown at internal/backend/backend.go:28
import (
"errors"
"github.com/zclconf/go-cty/cty"
"github.com/hashicorp/terraform/internal/configs/configschema"
"github.com/hashicorp/terraform/internal/states/statemgr"
"github.com/hashicorp/terraform/internal/tfdiags"
)
// DefaultStateName is the name of the default, initial state that every
// backend must have. This state cannot be deleted.
const DefaultStateName = "default"
var (
// ErrDefaultWorkspaceNotSupported is returned when an operation does not
// support using the default workspace, but requires a named workspace to
// be selected.
ErrDefaultWorkspaceNotSupported = errors.New("default workspace not supported\n" +
"You can create a new workspace with the \"workspace new\" command.")
// ErrWorkspacesNotSupported is an error returned when a caller attempts
// to perform an operation on a workspace other than "default" for a
// backend that doesn't support multiple workspaces.
//
// The caller can detect this to do special fallback behavior or produce
// a specific, helpful error message.
ErrWorkspacesNotSupported = errors.New("workspaces not supported")
)
// InitFn is used to initialize a new backend.
type InitFn func() Backend
// Backend is the minimal interface that must be implemented to enable Terraform.
type Backend interface {
// ConfigSchema returns a description of the expected configuration
// structure for the receiving backend.View on GitHub (pinned to d32a084675)