affaan-m/ECC · error

ErrUnauthorized

ErrUnauthorized

Error message

unauthorized

What it means

Sentinel error example in the error-handling skill documentation (Go section): ErrUnauthorized is the idiomatic sentinel for authorization failures checked with errors.Is. Duplicated across the ja-JP and es skill translations; not a runtime throw site.

Source

Thrown at skills/error-handling/SKILL.md:266

    return JSONResponse(
        status_code=500,
        content={"error": {"code": "INTERNAL_ERROR", "message": "An unexpected error occurred"}},
    )
```

## Go

### Sentinel Errors and Error Wrapping

```go
package domain

import "errors"

// Sentinel errors for type-checking
var (
    ErrNotFound    = errors.New("not found")
    ErrUnauthorized = errors.New("unauthorized")
    ErrConflict     = errors.New("conflict")
)

// Wrap errors with context — never lose the original
func (r *UserRepository) FindByID(ctx context.Context, id string) (*User, error) {
    user, err := r.db.QueryRow(ctx, "SELECT * FROM users WHERE id = $1", id)
    if errors.Is(err, sql.ErrNoRows) {
        return nil, fmt.Errorf("user %s: %w", id, ErrNotFound)
    }
    if err != nil {
        return nil, fmt.Errorf("querying user %s: %w", id, err)
    }
    return user, nil
}

// At the handler level, unwrap to determine response
func (h *Handler) GetUser(w http.ResponseWriter, r *http.Request) {
    user, err := h.service.GetUser(r.Context(), chi.URLParam(r, "id"))

View on GitHub (pinned to 06c5e118c4)

Solutions

  1. Provide valid credentials/configuration or wait for the rate-limit reset; verify permissions/role.
Defensive patterns

Strategy: validation

When it happens

Trigger: Triggered when SKILL.md rejects the current invocation: unauthorized

Common situations: Occurs while running skills/error-handling/SKILL.md with invalid arguments, missing flags, or a failing external dependency; the guard at skills/error-handling/SKILL.md:266 aborts the command with this message.

Understand the failure class


AI-assisted analysis of affaan-m/ECC@06c5e118c4 (2026-08-18). Data as JSON: /api/errors/467d7d6c89f11d03. Report an issue: GitHub.