You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
github_organization_custom_properties Read doesn't handle 404, breaking recovery after deletion #3641
resourceGithubCustomPropertiesRead in resource_github_organization_custom_properties.go propagates any error from client.Organizations.GetCustomProperty verbatim, without checking for a 404 (not found) response:
funcresourceGithubCustomPropertiesRead(d*schema.ResourceData, metaany) error {
ctx:=context.Background()
client:=meta.(*Owner).v3clientownerName:=meta.(*Owner).namecustomProperty, _, err:=client.Organizations.GetCustomProperty(ctx, ownerName, d.Get("property_name").(string))
iferr!=nil {
returnerr// <-- no 404 handling; should clear state (d.SetId("")) and return nil
}
...
}
This violates the standard Terraform provider idiom: when Read gets a 404 for a resource that no longer exists (e.g., because it was deleted out-of-band, or because a prior Delete succeeded but something is re-verifying), it should call d.SetId("") and return nil, signaling "no longer exists" rather than a hard error. The closely related repo-scoped sibling, resource_github_repository_custom_property.go, correctly does:
iferr, ok:= errors.AsType[*github.ErrorResponse](err); ok&&err.Response.StatusCode==404 {
// clears state
}
Impact
Any tool that relies on this resource's Read returning a clean "not found" for a deleted github_organization_custom_properties resource gets stuck: after a successful Delete, the next Read/refresh gets a 404 from GitHub (correctly, since the delete succeeded), but the 404 is returned as an error instead of "resource gone."
Steps to reproduce
terraform import or create a github_organization_custom_properties resource.
Delete the underlying property directly via the GitHub API (or via terraform destroy, then attempt a subsequent plan/refresh).
Observe that Read returns a hard error (404 Not Found) instead of clearing resource state.
Expected behavior
Read should detect a 404 from GetCustomProperty and call d.SetId(""), returning nil, consistent with resource_github_repository_custom_property.go's handling.
This repo is maintained by GitHub and community members on a best-effort basis. We'll get to this as soon as we can.
You can help us prioritize by adding details, reproduction steps, or a 👍 to issues that matter to you, and by joining the discussion on open issues and PRs.
Activity
github-actions commentedon Sep 14, 2026
👋 Hi, and thank you for opening this issue!
This repo is maintained by GitHub and community members on a best-effort basis. We'll get to this as soon as we can.
You can help us prioritize by adding details, reproduction steps, or a 👍 to issues that matter to you, and by joining the discussion on open issues and PRs.
🤖 This is an automated message.