Skip to content

[BUG]: State Update fails with panic on 6.6.0 #2708

Closed

Description

@BobcatProgrammer

Expected Behavior

I run terraform plan on a PR, it creates a plan

Actual Behavior

Terraform aborts with an error

Terraform Version

�Terraform v1.12.1 (Self Hosted Terraform Enterprise, if that makes a difference)
on linux_amd64
Initializing plugins and modules...
terraform-provider-github 6.6.0

Affected Resource(s)

  • github_organization_ruleset (i presume from the log)

Terraform Configuration Files

Steps to Reproduce

No response

Debug Output

Panic Output

Stack trace from the terraform-provider-github_v6.6.0 plugin:

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x8 pc=0xc69f0d]

goroutine 68 [running]:
github.com/integrations/terraform-provider-github/v6/github.resourceGithubOrganizationRulesetRead(0xc00092a200, {0xd352c0?, 0xc0005f4180?})
github.com/integrations/terraform-provider-github/v6/github/resource_github_organization_ruleset.go:560 +0x56d
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).read(0x107d470?, {0x107d470?, 0xc00083c9c0?}, 0xd?, {0xd352c0?, 0xc0005f4180?})
github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/resource.go:811 +0x15f
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).RefreshWithoutUpgrade(0xc000407a40, {0x107d470, 0xc00083c9c0}, 0xc00057a4e0, {0xd352c0, 0xc0005f4180})
github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/resource.go:1117 +0x529
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*GRPCProviderServer).ReadResource(0xc000392660, {0x107d470?, 0xc00083c900?}, 0xc00085e100)
github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/grpc_provider.go:708 +0x6c5
github.com/hashicorp/terraform-plugin-go/tfprotov5/tf5server.(*server).ReadResource(0xc0002492c0, {0x107d470?, 0xc00083c0f0?}, 0xc00022a000)
github.com/hashicorp/[email protected]/tfprotov5/tf5server/server.go:783 +0x309
github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tfplugin5._Provider_ReadResource_Handler({0xee16c0, 0xc0002492c0}, {0x107d470, 0xc00083c0f0}, 0xc00084e000, 0x0)
github.com/hashicorp/[email protected]/tfprotov5/internal/tfplugin5/tfplugin5_grpc.pb.go:482 +0x1a6
google.golang.org/grpc.(*Server).processUnaryRPC(0xc0001ab000, {0x107d470, 0xc00083c060}, {0x1081d68, 0xc0002e0180}, 0xc0007f70e0, 0xc0003d2630, 0x1719528, 0x0)
google.golang.org/[email protected]/server.go:1369 +0xdf8
google.golang.org/grpc.(*Server).handleStream(0xc0001ab000, {0x1081d68, 0xc0002e0180}, 0xc0007f70e0)
google.golang.org/[email protected]/server.go:1780 +0xe8b
google.golang.org/grpc.(*Server).serveStreams.func2.1()
google.golang.org/[email protected]/server.go:1019 +0x8b
created by google.golang.org/grpc.(*Server).serveStreams.func2 in goroutine 27
google.golang.org/[email protected]/server.go:1030 +0x125

Error: The terraform-provider-github_v6.6.0 plugin crashed!

This is always indicative of a bug within the plugin. It would be immensely
helpful if you could report the crash with the plugin's maintainers so that it
can be fixed. The output above should help diagnose the issue.

Code of Conduct

  • I agree to follow this project's Code of Conduct

Activity

  1. added
    Type: Bug
    Status: Triage
    on Jul 23, 2025
  2. BobcatProgrammer commented on Jul 24, 2025

    @BobcatProgrammer
    Author

    After further internal troubleshooting we have determined the issue to be missing permissions for the provider.
    I suggest to implement better error handling in the provider. A panic without detailed error messages is not particularly helpful.

  3. tvaughanRR commented on Aug 8, 2025

    @tvaughanRR

    I think we're seeing something (close to) the same issue

    I was just starting out with organization-level rulesets, so I manually created one in the UI, then added some HCL, then terraform imported the ruleset into my HCL. . .just to see what the provider would want to do and to try to better understand how the UI mapped to the terraform resource

    My HCL is:

    resource "github_organization_ruleset" "standard_required_checks" {
      name        = "standard-required-ruleset"
      target      = "branch"
      enforcement = "disabled"
    
      conditions {
        ref_name {
          include = ["~DEFAULT_BRANCH"]
          exclude = []
        }
        repository_name {
          include = ["~ALL"]
          exclude = []
        }
      }
    
      rules {
        deletion         = false # Only allow users with bypass permissions to delete matching refs.
        non_fast_forward = true # no force pushes
    
        required_status_checks {
          required_check {
            context        = "standard-pr-checks"
            integration_id = 0 # The optional integration ID that this status check must originate from. I think 0 means "no origination required"?
          }
        }
      }
    }
    

    The terraform import appeared to go cleanly, and the terraform plan showed that it wanted to add the required "standard-pr-checks" (even though I had already added that in the UI??)

    When I did the terraform apply the result was:

    Stack trace from the terraform-provider-github_v6.6.0 plugin:
    
    panic: interface conversion: interface {} is nil, not bool
    
    goroutine 48 [running]:
    github.com/integrations/terraform-provider-github/v6/github.expandRules({0xc000799a90?, 0xf1b546?, 0x0?}, 0x1)
    github.com/integrations/terraform-provider-github/v6/github/respository_rules_utils.go:343 +0x2a54
    github.com/integrations/terraform-provider-github/v6/github.resourceGithubRulesetObject(0xc0006cd800, {0xc000428a80, 0xb})
    github.com/integrations/terraform-provider-github/v6/github/respository_rules_utils.go:33 +0x2c5
    github.com/integrations/terraform-provider-github/v6/github.resourceGithubOrganizationRulesetUpdate(0xc0006cd800, {0xd352c0, 0xc0005630c0})
    github.com/integrations/terraform-provider-github/v6/github/resource_github_organization_ruleset.go:577 +0x71
    github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).update(0x107d470?, {0x107d470?, 0xc0006fe630?}, 0xd?, {0xd352c0?, 0xc0005630c0?})
    github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/resource.go:828 +0x15f
    github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).Apply(0xc0003bac40, {0x107d470, 0xc0006fe630}, 0xc000697a00, 0xc0006cd680, {0xd352c0, 0xc0005630c0})
    github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/resource.go:947 +0x83a
    github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*GRPCProviderServer).ApplyResourceChange(0xc000388690, {0x107d470?, 0xc0006fe570?}, 0xc00042ed20)
    github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/grpc_provider.go:1153 +0xd5c
    github.com/hashicorp/terraform-plugin-go/tfprotov5/tf5server.(*server).ApplyResourceChange(0xc000275900, {0x107d470?, 0xc0006e1b30?}, 0xc0004cfb20)
    github.com/hashicorp/[email protected]/tfprotov5/tf5server/server.go:865 +0x3d0
    github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tfplugin5._Provider_ApplyResourceChange_Handler({0xee16c0, 0xc000275900}, {0x107d470, 0xc0006e1b30}, 0xc0006cc980, 0x0)
    github.com/hashicorp/[email protected]/tfprotov5/internal/tfplugin5/tfplugin5_grpc.pb.go:518 +0x1a6
    google.golang.org/grpc.(*Server).processUnaryRPC(0xc0001a5000, {0x107d470, 0xc0006e1aa0}, {0x1081d68, 0xc00023a300}, 0xc0006f4b40, 0xc0004f6ab0, 0x1719558, 0x0)
    google.golang.org/[email protected]/server.go:1369 +0xdf8
    google.golang.org/grpc.(*Server).handleStream(0xc0001a5000, {0x1081d68, 0xc00023a300}, 0xc0006f4b40)
    google.golang.org/[email protected]/server.go:1780 +0xe8b
    google.golang.org/grpc.(*Server).serveStreams.func2.1()
    google.golang.org/[email protected]/server.go:1019 +0x8b
    created by google.golang.org/grpc.(*Server).serveStreams.func2 in goroutine 38
    google.golang.org/[email protected]/server.go:1030 +0x125
    
    Error: The terraform-provider-github_v6.6.0 plugin crashed!
    
    This is always indicative of a bug within the plugin. It would be immensely
    helpful if you could report the crash with the plugin's maintainers so that it
    can be fixed. The output above should help diagnose the issue.
    

    I'm running terraform v1.11.4 and the github provider v6.6.0

  4. deiga commented on Dec 7, 2025

    @deiga
    Collaborator

    I wonder if this is related to #2872

  5. moved this from Backlog to In Progress in Terraform Provideron Dec 7, 2025
  6. moved this from 🆕 Triage to ✅ Done in 🧰 Octokit Activeon Dec 8, 2025
  7. moved this from In Progress to Done in Terraform Provideron Dec 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Status: TriageType: Bug

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions