hashicorp/terraform · error

action schema not found for action %q

Error message

action schema not found for action %q

What it means

Returned by PlanAction (internal/grpcwrap/provider6.go:1183) when req.ActionType is not a key in p.schema.Actions (the action schemas advertised by the provider's GetProviderSchema). The handler needs actionSchema.ConfigSchema.ImpliedType() to decode the action config, so an unknown action type aborts planning immediately.

Source

Thrown at internal/grpcwrap/provider6.go:1183

func (p *provider6) DeleteState(ctx context.Context, req *tfplugin6.DeleteState_Request) (*tfplugin6.DeleteState_Response, error) {
	deleteStatesResp := p.provider.DeleteState(providers.DeleteStateRequest{
		TypeName: req.TypeName,
		StateId:  req.StateId,
	})

	resp := &tfplugin6.DeleteState_Response{
		Diagnostics: convert.AppendProtoDiag([]*tfplugin6.Diagnostic{}, deleteStatesResp.Diagnostics),
	}

	return resp, nil
}

func (p *provider6) PlanAction(_ context.Context, req *tfplugin6.PlanAction_Request) (*tfplugin6.PlanAction_Response, error) {
	resp := &tfplugin6.PlanAction_Response{}

	actionSchema, ok := p.schema.Actions[req.ActionType]
	if !ok {
		return nil, fmt.Errorf("action schema not found for action %q", req.ActionType)
	}

	ty := actionSchema.ConfigSchema.ImpliedType()
	configVal, err := decodeDynamicValue6(req.Config, ty)
	if err != nil {
		resp.Diagnostics = convert.AppendProtoDiag(resp.Diagnostics, err)
		return resp, nil
	}

	planResp := p.provider.PlanAction(providers.PlanActionRequest{
		ActionType:         req.ActionType,
		ProposedActionData: configVal,
		ClientCapabilities: providers.ClientCapabilities{
			DeferralAllowed:            true,
			WriteOnlyAttributesAllowed: true,
			ComputedBlocksAllowed:      true,
		},
	})

View on GitHub (pinned to c9def3e214)

Solutions

  1. Install/upgrade a provider version that declares the action type in GetProviderSchema.Actions.
  2. Verify the action type spelling and that it matches the provider's documented actions.
  3. Re-run terraform init to reconcile provider version with config.
  4. If authoring the provider, ensure GetProviderSchema returns the action in the Actions map.

Example fix

// before
// provider's GetProviderSchema omits Actions["restart"]
req.ActionType = "restart"  // -> action schema not found for action "restart"

// after
schema.Actions["restart"] = &providers.ActionSchema{ConfigSchema: ...}
Defensive patterns

Strategy: validation

Validate before calling

func actionAdvertised(s providers.GetProviderSchemaResponse, action string) bool {
    _, ok := s.Actions[action]
    return ok
}

Type guard

func advertisedActions(s providers.GetProviderSchemaResponse) []string {
    out := make([]string, 0, len(s.Actions))
    for k := range s.Actions { out = append(out, k) }
    return out
}

Try / catch

if _, err := server.PlanAction(ctx, req); err != nil {
    if strings.Contains(err.Error(), "action schema not found") {
        // upgrade provider or remove the action reference
    }
}

Prevention

When it happens

Trigger: Terraform core sends a PlanAction RPC for an action type the provider did not register in GetProviderSchema.Actions; the map lookup p.schema.Actions[req.ActionType] returns ok==false.

Common situations: Provider version mismatch (core references an action type the older/newer provider doesn't expose), typo in an action reference, experimental action removed between provider releases, or a test provider missing the action schema.

Related errors


AI-assisted analysis of hashicorp/terraform@c9def3e214 (2026-08-07). Data as JSON: /api/errors/c799148e68955aa0. Report an issue: GitHub.