Skip to content

[BUG]: Refreshing github_organization_ruleset crashes Terraform plugin with segfault #2450

Closed

Description

@StefanJokicTide

Expected Behavior

github_organization_ruleset applies correctly

Actual Behavior

Terraform provider crashes with

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

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

goroutine 123 [running]:
github.com/integrations/terraform-provider-github/v6/github.resourceGithubOrganizationRulesetRead(0xc0000ce900, {0xd25300?, 0xc00063d100?})
	github.com/integrations/terraform-provider-github/v6/github/resource_github_organization_ruleset.go:525 +0x56d
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).read(0x1064f10?, {0x1064f10?, 0xc000890b40?}, 0xd?, {0xd25300?, 0xc00063d100?})
	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(0xc000407c00, {0x1064f10, 0xc000890b40}, 0xc00098b450, {0xd25300, 0xc00063d100})
	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(0xc000352810, {0x1064f10?, 0xc000890a80?}, 0xc00063c0c0)
	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(0xc00024cb40, {0x1064f10?, 0xc0008900c0?}, 0xc00023e070)
	github.com/hashicorp/[email protected]/tfprotov5/tf5server/server.go:783 +0x309
github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tfplugin5._Provider_ReadResource_Handler({0xecb700, 0xc00024cb40}, {0x1064f10, 0xc0008900c0}, 0xc0000ce180, 0x0)
	github.com/hashicorp/[email protected]/tfprotov5/internal/tfplugin5/tfplugin5_grpc.pb.go:482 +0x1a6
google.golang.org/grpc.(*Server).processUnaryRPC(0xc0000ea000, {0x1064f10, 0xc000890000}, {0x1069810, 0xc0002dc180}, 0xc00071de60, 0xc0002ad800, 0x16f1508, 0x0)
	google.golang.org/[email protected]/server.go:1369 +0xdf8
google.golang.org/grpc.(*Server).handleStream(0xc0000ea000, {0x1069810, 0xc0002dc180}, 0xc00071de60)
	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 68
	google.golang.org/[email protected]/server.go:1030 +0x125

Error: The terraform-provider-github_v6.3.1 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.

Terraform Version

Terraform 1.9.6

Affected Resource(s)

  • github_organization_ruleset

Terraform Configuration Files

No response

Steps to Reproduce

terraform plan/apply

Debug Output

No response

Panic Output

No response

Code of Conduct

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

Activity

  1. added
    Status: Triage
    Type: Bug
    on Nov 4, 2024
  2. moved this from 🆕 Triage to 🔥 Backlog in 🧰 Octokit Activeon Dec 23, 2024
  3. added a commit that references this issue on Jul 17, 2025
    b8c32f7
  4. github-actions commented on Aug 2, 2025

    @github-actions

    👋 Hey Friends, this issue has been automatically marked as stale because it has no recent activity. It will be closed if no further activity occurs. Please add the Status: Pinned label if you feel that this issue needs to remain open/active. Thank you for your contributions and help in keeping things tidy!

  5. added
    Status: Stale
    on Aug 2, 2025
  6. moved this from 🔥 Backlog to ✅ Done in 🧰 Octokit Activeon Aug 10, 2025
  7. moved this from Done to In Review in Terraform Provideron Nov 20, 2025
  8. diofeher commented on Nov 26, 2025

    @diofeher
    Collaborator

    Hi @StefanJokicTide, thanks for the report!

    Can you provide a minimal configuration example to reproduce this issue?

  9. self-assigned this
    on Nov 26, 2025
  10. nickfloyd commented on Nov 26, 2025

    @nickfloyd
    Contributor

    Can you provide a minimal configuration example to reproduce this issue?

    @diofeher Here is the one I used (with substitutions)

    terraform {
      required_providers {
        github = {
          source  = "integrations/github"
          version = "~> 6.3.0"  # Version with the bug
        }
      }
    }
    
    provider "github" {
      owner = "org-name" 
      # token should have insufficient permissions to trigger an error
      # OR point to a non-existent/inaccessible organization
    }
    
    resource "github_organization_ruleset" "test" {
      name        = "test-ruleset"
      target      = "branch"
      enforcement = "active"
    
      conditions {
        ref_name {
          include = ["~DEFAULT_BRANCH"]
          exclude = []
        }
      }
    
      rules {
        creation = true
      }
    }
    
  11. self-assigned this
    on Dec 1, 2025
  12. added a commit that references this issue on Dec 1, 2025
    891b28e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Status: StaleStatus: TriageType: Bug

Type

No type

Projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions