Skip to content

Conversation

eldad
Copy link

@eldad eldad commented Sep 23, 2025

Example panic:

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=0xcac607]

goroutine 4723 [running]:
github.com/integrations/terraform-provider-github/v6/github.resourceGithubRepositoryRulesetRead(0xc000b0d300, {0xd352c0?, 0xc00089ea00?})
	github.com/integrations/terraform-provider-github/v6/github/resource_github_repository_ruleset.go:580 +0x567
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).read(0x107d470?, {0x107d470?, 0xc000a40ff0?}, 0xd?, {0xd352c0?, 0xc00089ea00?})
	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(0xc0003ed7a0, {0x107d470, 0xc000a40ff0}, 0xc000b1b1e0, {0xd352c0, 0xc00089ea00})
	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(0xc00036c678, {0x107d470?, 0xc000a40cf0?}, 0xc0006dea40)
	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(0xc00026d900, {0x107d470?, 0xc000a404b0?}, 0xc00025c3f0)
	github.com/hashicorp/[email protected]/tfprotov5/tf5server/server.go:783 +0x309
github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tfplugin5._Provider_ReadResource_Handler({0xee16c0, 0xc00026d900}, {0x107d470, 0xc000a404b0}, 0xc000b0ce00, 0x0)
	github.com/hashicorp/[email protected]/tfprotov5/internal/tfplugin5/tfplugin5_grpc.pb.go:482 +0x1a6
google.golang.org/grpc.(*Server).processUnaryRPC(0xc000197000, {0x107d470, 0xc000a40420}, {0x1081d68, 0xc00027c300}, 0xc0009a1200, 0xc00045aab0, 0x1719528, 0x0)
	google.golang.org/[email protected]/server.go:1369 +0xdf8
google.golang.org/grpc.(*Server).handleStream(0xc000197000, {0x1081d68, 0xc00027c300}, 0xc0009a1200)
	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 12
	google.golang.org/[email protected]/server.go:1030 +0x125

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

Resolves #2757 and #2737.


Before the change?

  • Panic when ruleset response for a repository is empty.

After the change?

  • No panic.

Pull request checklist

  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been reviewed and added / updated if needed (for bug fixes / features)

Does this introduce a breaking change?

Please see our docs on breaking changes to help!

  • Yes
  • No

Example panic:

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=0xcac607]

goroutine 4723 [running]:
github.com/integrations/terraform-provider-github/v6/github.resourceGithubRepositoryRulesetRead(0xc000b0d300, {0xd352c0?, 0xc00089ea00?})
	github.com/integrations/terraform-provider-github/v6/github/resource_github_repository_ruleset.go:580 +0x567
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).read(0x107d470?, {0x107d470?, 0xc000a40ff0?}, 0xd?, {0xd352c0?, 0xc00089ea00?})
	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(0xc0003ed7a0, {0x107d470, 0xc000a40ff0}, 0xc000b1b1e0, {0xd352c0, 0xc00089ea00})
	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(0xc00036c678, {0x107d470?, 0xc000a40cf0?}, 0xc0006dea40)
	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(0xc00026d900, {0x107d470?, 0xc000a404b0?}, 0xc00025c3f0)
	github.com/hashicorp/[email protected]/tfprotov5/tf5server/server.go:783 +0x309
github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tfplugin5._Provider_ReadResource_Handler({0xee16c0, 0xc00026d900}, {0x107d470, 0xc000a404b0}, 0xc000b0ce00, 0x0)
	github.com/hashicorp/[email protected]/tfprotov5/internal/tfplugin5/tfplugin5_grpc.pb.go:482 +0x1a6
google.golang.org/grpc.(*Server).processUnaryRPC(0xc000197000, {0x107d470, 0xc000a40420}, {0x1081d68, 0xc00027c300}, 0xc0009a1200, 0xc00045aab0, 0x1719528, 0x0)
	google.golang.org/[email protected]/server.go:1369 +0xdf8
google.golang.org/grpc.(*Server).handleStream(0xc000197000, {0x1081d68, 0xc00027c300}, 0xc0009a1200)
	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 12
	google.golang.org/[email protected]/server.go:1030 +0x125

Error: The terraform-provider-github_v6.6.0 plugin crashed!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG]: Plugin crashed while apply

2 participants