{"record":{"id":"467d7d6c89f11d03","repo":"affaan-m/ECC","slug":"errunauthorized","errorCode":"ErrUnauthorized","errorMessage":"unauthorized","messagePattern":"unauthorized","errorType":"error_code","errorClass":null,"httpStatus":403,"severity":"error","filePath":"skills/error-handling/SKILL.md","lineNumber":266,"sourceCode":"    return JSONResponse(\n        status_code=500,\n        content={\"error\": {\"code\": \"INTERNAL_ERROR\", \"message\": \"An unexpected error occurred\"}},\n    )\n```\n\n## Go\n\n### Sentinel Errors and Error Wrapping\n\n```go\npackage domain\n\nimport \"errors\"\n\n// Sentinel errors for type-checking\nvar (\n    ErrNotFound    = errors.New(\"not found\")\n    ErrUnauthorized = errors.New(\"unauthorized\")\n    ErrConflict     = errors.New(\"conflict\")\n)\n\n// Wrap errors with context — never lose the original\nfunc (r *UserRepository) FindByID(ctx context.Context, id string) (*User, error) {\n    user, err := r.db.QueryRow(ctx, \"SELECT * FROM users WHERE id = $1\", id)\n    if errors.Is(err, sql.ErrNoRows) {\n        return nil, fmt.Errorf(\"user %s: %w\", id, ErrNotFound)\n    }\n    if err != nil {\n        return nil, fmt.Errorf(\"querying user %s: %w\", id, err)\n    }\n    return user, nil\n}\n\n// At the handler level, unwrap to determine response\nfunc (h *Handler) GetUser(w http.ResponseWriter, r *http.Request) {\n    user, err := h.service.GetUser(r.Context(), chi.URLParam(r, \"id\"))","sourceCodeStart":248,"sourceCodeEnd":284,"githubUrl":"https://github.com/affaan-m/ECC/blob/06c5e118c4d3e6c3b7f9445f973a2194c82de193/skills/error-handling/SKILL.md#L248-L284","documentation":"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.","triggerScenarios":"Triggered when SKILL.md rejects the current invocation: unauthorized","commonSituations":"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.","solutions":["Provide valid credentials/configuration or wait for the rate-limit reset; verify permissions/role."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"06c5e118c4d3e6c3b7f9445f973a2194c82de193","analyzedAt":"2026-08-18T11:27:13.915Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}