Skip to content

Commit 1bc9406

Browse files
fix indentations/ol
1 parent 7603b63 commit 1bc9406

File tree

3 files changed

+239
-238
lines changed

3 files changed

+239
-238
lines changed

content/guides/github-sonarqube-sandbox/troubleshoot.md

Lines changed: 131 additions & 131 deletions
Original file line numberDiff line numberDiff line change
@@ -18,83 +18,83 @@ Issue: Claude reports `I don't have any MCP tools available`.
1818

1919
Solution:
2020

21-
1. Verify you're using the authorization header:
21+
1. Verify you're using the authorization header:
2222

23-
```plaintext
24-
--header "Authorization: Bearer ${mcpToken}"
25-
```
23+
```plaintext
24+
--header "Authorization: Bearer ${mcpToken}"
25+
```
2626
27-
2. Check you're waiting for MCP initialization:
27+
2. Check you're waiting for MCP initialization:
2828
29-
{{< tabs group="language" >}}
30-
{{< tab name="TypeScript" >}}
29+
{{< tabs group="language" >}}
30+
{{< tab name="TypeScript" >}}
3131
32-
```typescript
33-
await new Promise((resolve) => setTimeout(resolve, 1000));
34-
```
32+
```typescript
33+
await new Promise((resolve) => setTimeout(resolve, 1000));
34+
```
3535
36-
{{< /tab >}}
37-
{{< tab name="Python" >}}
36+
{{< /tab >}}
37+
{{< tab name="Python" >}}
3838
39-
```python
40-
await asyncio.sleep(1)
41-
```
39+
```python
40+
await asyncio.sleep(1)
41+
```
4242
43-
{{< /tab >}}
44-
{{< /tabs >}}
43+
{{< /tab >}}
44+
{{< /tabs >}}
4545
46-
3. Ensure credentials are in both `envs` and `mcp` configuration:
46+
3. Ensure credentials are in both `envs` and `mcp` configuration:
4747
48-
{{< tabs group="language" >}}
49-
{{< tab name="TypeScript" >}}
48+
{{< tabs group="language" >}}
49+
{{< tab name="TypeScript" >}}
5050
51-
```typescript
52-
const sbx = await Sandbox.betaCreate({
53-
envs: {
54-
ANTHROPIC_API_KEY: process.env.ANTHROPIC_API_KEY!,
55-
GITHUB_TOKEN: process.env.GITHUB_TOKEN!,
56-
SONARQUBE_TOKEN: process.env.SONARQUBE_TOKEN!,
57-
},
58-
mcp: {
59-
githubOfficial: {
60-
githubPersonalAccessToken: process.env.GITHUB_TOKEN!,
61-
},
62-
sonarqube: {
63-
org: process.env.SONARQUBE_ORG!,
64-
token: process.env.SONARQUBE_TOKEN!,
65-
url: "https://sonarcloud.io",
66-
},
67-
},
68-
});
69-
```
51+
```typescript
52+
const sbx = await Sandbox.betaCreate({
53+
envs: {
54+
ANTHROPIC_API_KEY: process.env.ANTHROPIC_API_KEY!,
55+
GITHUB_TOKEN: process.env.GITHUB_TOKEN!,
56+
SONARQUBE_TOKEN: process.env.SONARQUBE_TOKEN!,
57+
},
58+
mcp: {
59+
githubOfficial: {
60+
githubPersonalAccessToken: process.env.GITHUB_TOKEN!,
61+
},
62+
sonarqube: {
63+
org: process.env.SONARQUBE_ORG!,
64+
token: process.env.SONARQUBE_TOKEN!,
65+
url: "https://sonarcloud.io",
66+
},
67+
},
68+
});
69+
```
7070
71-
{{< /tab >}}
72-
{{< tab name="Python" >}}
71+
{{< /tab >}}
72+
{{< tab name="Python" >}}
7373
74-
```python
75-
sbx = await AsyncSandbox.beta_create(
76-
envs={
77-
"ANTHROPIC_API_KEY": os.getenv("ANTHROPIC_API_KEY"),
78-
"GITHUB_TOKEN": os.getenv("GITHUB_TOKEN"),
79-
"SONARQUBE_TOKEN": os.getenv("SONARQUBE_TOKEN"),
80-
},
81-
mcp={
82-
"githubOfficial": {
83-
"githubPersonalAccessToken": os.getenv("GITHUB_TOKEN"),
74+
```python
75+
sbx = await AsyncSandbox.beta_create(
76+
envs={
77+
"ANTHROPIC_API_KEY": os.getenv("ANTHROPIC_API_KEY"),
78+
"GITHUB_TOKEN": os.getenv("GITHUB_TOKEN"),
79+
"SONARQUBE_TOKEN": os.getenv("SONARQUBE_TOKEN"),
8480
},
85-
"sonarqube": {
86-
"org": os.getenv("SONARQUBE_ORG"),
87-
"token": os.getenv("SONARQUBE_TOKEN"),
88-
"url": "https://sonarcloud.io",
81+
mcp={
82+
"githubOfficial": {
83+
"githubPersonalAccessToken": os.getenv("GITHUB_TOKEN"),
84+
},
85+
"sonarqube": {
86+
"org": os.getenv("SONARQUBE_ORG"),
87+
"token": os.getenv("SONARQUBE_TOKEN"),
88+
"url": "https://sonarcloud.io",
89+
},
8990
},
90-
},
91-
)
92-
```
91+
)
92+
```
9393
94-
{{< /tab >}}
95-
{{< /tabs >}}
94+
{{< /tab >}}
95+
{{< /tabs >}}
9696
97-
4. Verify your API tokens are valid and have proper scopes.
97+
4. Verify your API tokens are valid and have proper scopes.
9898
9999
## GitHub tools work but SonarQube doesn't
100100
@@ -165,24 +165,24 @@ Solution:
165165
2. Test with a public repository first.
166166
3. Ensure the repository owner and name are correct in your `.env`:
167167

168-
{{< tabs group="language" >}}
169-
{{< tab name="TypeScript" >}}
168+
{{< tabs group="language" >}}
169+
{{< tab name="TypeScript" >}}
170170

171-
```plaintext
172-
GITHUB_OWNER=your_github_username
173-
GITHUB_REPO=your_repository_name
174-
```
171+
```plaintext
172+
GITHUB_OWNER=your_github_username
173+
GITHUB_REPO=your_repository_name
174+
```
175175

176-
{{< /tab >}}
177-
{{< tab name="Python" >}}
176+
{{< /tab >}}
177+
{{< tab name="Python" >}}
178178

179-
```plaintext
180-
GITHUB_OWNER=your_github_username
181-
GITHUB_REPO=your_repository_name
182-
```
179+
```plaintext
180+
GITHUB_OWNER=your_github_username
181+
GITHUB_REPO=your_repository_name
182+
```
183183

184-
{{< /tab >}}
185-
{{< /tabs >}}
184+
{{< /tab >}}
185+
{{< /tabs >}}
186186

187187
## Workflow times out or runs too long
188188

@@ -192,34 +192,34 @@ Solutions:
192192

193193
1. Use `timeoutMs: 0` (TypeScript) or `timeout_ms=0` (Python) for complex workflows to allow unlimited time:
194194

195-
{{< tabs group="language" >}}
196-
{{< tab name="TypeScript" >}}
197-
198-
```typescript
199-
await sbx.commands.run(
200-
`echo '${prompt}' | claude -p --dangerously-skip-permissions`,
201-
{
202-
timeoutMs: 0, // No timeout
203-
onStdout: console.log,
204-
onStderr: console.log,
205-
},
206-
);
207-
```
208-
209-
{{< /tab >}}
210-
{{< tab name="Python" >}}
211-
212-
```python
213-
await sbx.commands.run(
214-
f"echo '{prompt}' | claude -p --dangerously-skip-permissions",
215-
timeout_ms=0, # No timeout
216-
on_stdout=print,
217-
on_stderr=print,
218-
)
219-
```
220-
221-
{{< /tab >}}
222-
{{< /tabs >}}
195+
{{< tabs group="language" >}}
196+
{{< tab name="TypeScript" >}}
197+
198+
```typescript
199+
await sbx.commands.run(
200+
`echo '${prompt}' | claude -p --dangerously-skip-permissions`,
201+
{
202+
timeoutMs: 0, // No timeout
203+
onStdout: console.log,
204+
onStderr: console.log,
205+
},
206+
);
207+
```
208+
209+
{{< /tab >}}
210+
{{< tab name="Python" >}}
211+
212+
```python
213+
await sbx.commands.run(
214+
f"echo '{prompt}' | claude -p --dangerously-skip-permissions",
215+
timeout_ms=0, # No timeout
216+
on_stdout=print,
217+
on_stderr=print,
218+
)
219+
```
220+
221+
{{< /tab >}}
222+
{{< /tabs >}}
223223

224224
2. Break complex workflows into smaller, focused tasks.
225225
3. Monitor your Anthropic API credit usage.
@@ -293,48 +293,48 @@ Solution:
293293

294294
1. Ensure `dotenv` is loaded at the top of your file:
295295

296-
```typescript
297-
import "dotenv/config";
298-
```
296+
```typescript
297+
import "dotenv/config";
298+
```
299299

300300
2. Verify the `.env` file is in the same directory as your script.
301301

302302
3. Check variable names match exactly (case-sensitive):
303303

304-
```typescript
305-
// .env file
306-
GITHUB_TOKEN = ghp_xxxxx;
304+
```typescript
305+
// .env file
306+
GITHUB_TOKEN = ghp_xxxxx;
307307

308-
// In code
309-
process.env.GITHUB_TOKEN; // Correct
310-
process.env.github_token; // Wrong - case doesn't match
311-
```
308+
// In code
309+
process.env.GITHUB_TOKEN; // Correct
310+
process.env.github_token; // Wrong - case doesn't match
311+
```
312312

313-
{{< /tab >}}
314-
{{< tab name="Python" >}}
313+
{{< /tab >}}
314+
{{< tab name="Python" >}}
315315

316-
1. Ensure `dotenv` is loaded at the top of your file:
316+
1. Ensure `dotenv` is loaded at the top of your file:
317317

318-
```python
319-
from dotenv import load_dotenv
320-
load_dotenv()
321-
```
318+
```python
319+
from dotenv import load_dotenv
320+
load_dotenv()
321+
```
322322

323-
2. Verify the `.env` file is in the same directory as your script.
323+
2. Verify the `.env` file is in the same directory as your script.
324324

325-
3. Check variable names match exactly (case-sensitive):
325+
3. Check variable names match exactly (case-sensitive):
326326

327-
```python
328-
# .env file
329-
GITHUB_TOKEN=ghp_xxxxx
327+
```python
328+
# .env file
329+
GITHUB_TOKEN=ghp_xxxxx
330330

331-
# In code
332-
os.getenv("GITHUB_TOKEN") # Correct
333-
os.getenv("github_token") # Wrong - case doesn't match
334-
```
331+
# In code
332+
os.getenv("GITHUB_TOKEN") # Correct
333+
os.getenv("github_token") # Wrong - case doesn't match
334+
```
335335

336-
{{< /tab >}}
337-
{{< /tabs >}}
336+
{{< /tab >}}
337+
{{< /tabs >}}
338338

339339
## SonarQube returns empty results
340340

0 commit comments

Comments
 (0)