REST clients return bare status errors — use status.Code

SkillCloud & infra

Use when a REST-backed resource (SCIM group/user, Grafana) fails to soft-delete on 404, or when cxsdk.Code returns Unknown for a status.Error from rest/client.go.

Available today. Use it from your connected AI after setup.

Add ahel to your AI once: Claude, ChatGPT, Cursor, Claude Code or Codex. Then ask it to use this.

Then ask your AI: use the REST clients return bare status errors skill

What this skill tells your AI

The instructions your AI receives, as published by coralogix/terraform-provider-coralogix in .claude/skills/rest-client-not-found-detection/SKILL.md and read by ahel’s review.

Trigger: A read/delete path for SCIM groups, SCIM users, or Grafana uses cxsdk.Code(err) == codes.NotFound, but the branch never runs for a real 404.

Fix: Keep rest/client.go returning a bare status error, and check with status.Code:

// internal/clientset/rest/client.go
return "", status.Error(codes.NotFound, "Not found")

// call site
if status.Code(err) == codes.NotFound { ... RemoveResource }

Why: cxsdk.Code only unwraps *cxsdk.SdkAPIError (SDK gRPC clients). The hand-rolled REST client returns a plain status.Error. Matching pair is status.Code. Wrapping REST errors in SdkAPIError only to keep cxsdk.Code is unnecessary.

Trap: Do not mix them. After a wrap, status.Code returns Unknown. After no wrap, cxsdk.Code returns Unknown. OpenAPI facade clients are separate — use cxsdkOpenapi.IsNotFound.

Signals

GitHub stars
22
Forks
14
Last commit
Sep 2026
Advanced
Item type
skill
Key
rest-client-not-found-detection
Source
github.com/coralogix/terraform-provider-coralogix