{"record":{"id":"efdb51ef478f6a37","repo":"affaan-m/ECC","slug":"forbidden-resp-json-get-detail-check-permi","errorCode":null,"errorMessage":"Forbidden: {resp.json().get('detail', 'check permissions')}","messagePattern":"Forbidden: (.+?)","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"skills/x-api/SKILL.md","lineNumber":206,"sourceCode":"\nremaining = int(resp.headers.get(\"x-rate-limit-remaining\", 0))\nif remaining < 5:\n    reset = int(resp.headers.get(\"x-rate-limit-reset\", 0))\n    wait = max(0, reset - int(time.time()))\n    print(f\"Rate limit approaching. Resets in {wait}s\")\n```\n\n## Error Handling\n\n```python\nresp = oauth.post(\"https://api.x.com/2/tweets\", json={\"text\": content})\nif resp.status_code == 201:\n    return resp.json()[\"data\"][\"id\"]\nelif resp.status_code == 429:\n    reset = int(resp.headers[\"x-rate-limit-reset\"])\n    raise Exception(f\"Rate limited. Resets at {reset}\")\nelif resp.status_code == 403:\n    raise Exception(f\"Forbidden: {resp.json().get('detail', 'check permissions')}\")\nelse:\n    raise Exception(f\"X API error {resp.status_code}: {resp.text}\")\n```\n\n## Security\n\n- **Never hardcode tokens.** Use environment variables or `.env` files.\n- **Never commit `.env` files.** Add to `.gitignore`.\n- **Rotate tokens** if exposed. Regenerate at developer.x.com.\n- **Use read-only tokens** when write access is not needed.\n- **Store OAuth secrets securely** — not in source code or logs.\n\n## Integration with Content Engine\n\nUse `brand-voice` plus `content-engine` to generate platform-native content, then post via X API:\n1. Pull recent original posts when voice matching matters\n2. Build or reuse a `VOICE PROFILE`\n3. Generate content with `content-engine` in X-native format","sourceCodeStart":188,"sourceCodeEnd":224,"githubUrl":"https://github.com/affaan-m/ECC/blob/06c5e118c4d3e6c3b7f9445f973a2194c82de193/skills/x-api/SKILL.md#L188-L224","documentation":"Posting pattern in the x-api skill: the API returned 403, meaning the app lacks permission for the action (wrong app tier, missing scopes, or read-only credentials); the API's detail field is surfaced with a fallback hint.","triggerScenarios":"Triggered when SKILL.md rejects the current invocation: Forbidden: <value>","commonSituations":"Occurs while running skills/x-api/SKILL.md with invalid arguments, missing flags, or a failing external dependency; the guard at skills/x-api/SKILL.md:206 aborts the command with this message.","solutions":["Provide valid credentials/configuration or wait for the rate-limit reset; verify permissions/role."],"exampleFix":null,"handlingStrategy":"fallback","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-23T08:17:48.524Z"}