Skip to content

[BUG]: github_issue_label causes provider panic (nil pointer dereference) during apply #3002

@davewebhost

Description

@davewebhost

Expected Behavior

The github_issue_label resource should create or update the specified label successfully, or return a handled API error if the request fails.

Actual Behavior

terraform apply causes the GitHub provider to panic with a nil pointer dereference during creation of a github_issue_label resource. Terraform reports that the provider plugin crashed.

Full panic stack trace included below.

Terraform Version

Terraform v1.14.2

Affected Resource(s)

github_issue_label

Terraform Configuration Files

provider "github" {
  owner = "REDACTED_OWNER"
}
resource "github_issue_label" "terraform_managed" {
  repository  = "REDACTED_REPO"
  name        = "terraform-managed"
  color       = "5319e7"
  description = "Managed by Terraform"
}

Steps to Reproduce

  1. Configure the GitHub provider with a valid owner and authentication via GITHUB_TOKEN.
  2. Add a github_issue_label resource as shown in the configuration above.
  3. Run terraform init.
  4. Run terraform plan (plan succeeds).
  5. Run terraform apply.
  6. Provider crashes during label creation with a nil pointer dereference.

Debug Output

github_issue_label.terraform_managed: Creating...
╷
│ Error: Plugin did not respond
│
│   with github_issue_label.terraform_managed,
│   on main.tf line 1, in resource "github_issue_label" "terraform_managed":
│    1: resource "github_issue_label" "terraform_managed" {
│
│ The plugin encountered an error, and failed to respond to the plugin.(*GRPCProvider).ApplyResourceChange call. The plugin logs may contain more details.
╵

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

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

goroutine 65 [running]:
github.com/integrations/terraform-provider-github/v6/github.resourceGithubIssueLabelCreateOrUpdate(0xc000537c00, {0xd49780, 0xc0002fb4c0})
        github.com/integrations/terraform-provider-github/v6/github/resource_github_issue_label.go:103 +0x510
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).create(0x1096870?, {0x1096870?, 0xc000229e30?}, 0xd?, {0xd49780?, 0xc0002fb4c0?})
        github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/resource.go:794 +0x15f
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).Apply(0xc00039b6c0, {0x1096870, 0xc000229e30}, 0xc000533450, 0xc000537a80, {0xd49780, 0xc0002fb4c0})
        github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/resource.go:937 +0xa89
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*GRPCProviderServer).ApplyResourceChange(0xc0003805b8, {0x1096870?, 0xc000229d70?}, 0xc0004b8640)
        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(0xc00027b860, {0x1096870?, 0xc0002293b0?}, 0xc00014b1f0)
        github.com/hashicorp/[email protected]/tfprotov5/tf5server/server.go:865 +0x3d0
github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tfplugin5._Provider_ApplyResourceChange_Handler({0xef6da0, 0xc00027b860}, {0x1096870, 0xc0002293b0}, 0xc000537280, 0x0)
        github.com/hashicorp/[email protected]/tfprotov5/internal/tfplugin5/tfplugin5_grpc.pb.go:518 +0x1a6
google.golang.org/grpc.(*Server).processUnaryRPC(0xc000199000, {0x1096870, 0xc000229320}, {0x109b280, 0xc0002ce180}, 0xc000271680, 0xc000476e10, 0x173c578, 0x0)
        google.golang.org/[email protected]/server.go:1369 +0xdf8
google.golang.org/grpc.(*Server).handleStream(0xc000199000, {0x109b280, 0xc0002ce180}, 0xc000271680)
        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 11
        google.golang.org/[email protected]/server.go:1030 +0x125

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

Panic Output

Second occurrence with provider version v6.9.0:


github_issue_label.terraform_managed: Creating...
╷
│ Error: Request cancelled
│
│   with github_issue_label.terraform_managed,
│   on main.tf line 1, in resource "github_issue_label" "terraform_managed":
│    1: resource "github_issue_label" "terraform_managed" {
│
│ The plugin.(*GRPCProvider).ApplyResourceChange request was cancelled.
╵

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

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

goroutine 69 [running]:
github.com/integrations/terraform-provider-github/v6/github.resourceGithubIssueLabelCreateOrUpdate(0xc0002f5200, {0xe55200, 0xc00053c540})
        github.com/integrations/terraform-provider-github/v6/github/resource_github_issue_label.go:104 +0x510
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).create(0x120ff30?, {0x120ff30?, 0xc0002f1a40?}, 0xd?, {0xe55200?, 0xc00053c540?})
        github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/resource.go:837 +0x15f
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).Apply(0xc00040b700, {0x120ff30, 0xc0002f1a40}, 0xc00058e340, 0xc0002f50e0, {0xe55200, 0xc00053c540})
        github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/resource.go:980 +0xb47
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*GRPCProviderServer).ApplyResourceChange(0xc0003ee4f8, {0x120ff30?, 0xc0002f1980?}, 0xc0002cfa40)
        github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/grpc_provider.go:1499 +0x1085
github.com/hashicorp/terraform-plugin-go/tfprotov5/tf5server.(*server).ApplyResourceChange(0xc00026bea0, {0x120ff30?, 0xc0002f0ea0?}, 0xc0002db300)
        github.com/hashicorp/[email protected]/tfprotov5/tf5server/server.go:944 +0x3b9
github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tfplugin5._Provider_ApplyResourceChange_Handler({0x1063980, 0xc00026bea0}, {0x120ff30, 0xc0002f0ea0}, 0xc0002db280, 0x0)
        github.com/hashicorp/[email protected]/tfprotov5/internal/tfplugin5/tfplugin5_grpc.pb.go:789 +0x1a6
google.golang.org/grpc.(*Server).processUnaryRPC(0xc00026c200, {0x120ff30, 0xc0002f0e10}, 0xc0000a2780, 0xc0004d6f30, 0x19a79c8, 0x0)
        google.golang.org/[email protected]/server.go:1431 +0x1036
google.golang.org/grpc.(*Server).handleStream(0xc00026c200, {0x1210838, 0xc000419380}, 0xc0000a2780)
        google.golang.org/[email protected]/server.go:1842 +0xb88
google.golang.org/grpc.(*Server).serveStreams.func2.1()
        google.golang.org/[email protected]/server.go:1061 +0x7f
created by google.golang.org/grpc.(*Server).serveStreams.func2 in goroutine 21
        google.golang.org/[email protected]/server.go:1072 +0x11d

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

Code of Conduct

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions