Skip to content

Commit b65bd8f

Browse files
committed
feat: rewrite error hints with jam personality
1 parent d58d19c commit b65bd8f

1 file changed

Lines changed: 34 additions & 35 deletions

File tree

src/utils/errors.ts

Lines changed: 34 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -31,69 +31,68 @@ export type ErrorCode =
3131
*/
3232
export const ERROR_HINTS: Partial<Record<ErrorCode, string>> = {
3333
CONFIG_INVALID:
34-
'Check your .jamrc or config file for syntax errors.\n' +
35-
'Run `jam config show` to see the merged config, or `jam init` to generate a fresh one.',
34+
'Your config has a syntax error.\n' +
35+
'Run `jam config show` to see what\'s loaded, or `jam init` to start fresh.',
3636
CONFIG_NOT_FOUND:
37-
'The requested profile does not exist. Run `jam config show` to see available profiles.',
37+
'That profile doesn\'t exist. Run `jam config show` to see what\'s available.',
3838
PROVIDER_AUTH_FAILED:
39-
'Set the appropriate API key for your provider:\n' +
39+
'No API key found. Set one for your provider:\n' +
4040
' Anthropic: export ANTHROPIC_API_KEY=sk-ant-...\n' +
4141
' OpenAI: export OPENAI_API_KEY=sk-...\n' +
4242
' Groq: export GROQ_API_KEY=gsk_...\n' +
43-
' Ollama: No API key needed — just run `ollama serve`',
43+
' Ollama: No key needed — just run `ollama serve`',
4444
PROVIDER_UNAVAILABLE:
45-
'The provider is not reachable. Check your network or provider status.\n' +
46-
'For Ollama: make sure it\'s running with `ollama serve`\n' +
47-
'Run `jam doctor` for full diagnostics.',
45+
'Can\'t reach the provider. If it\'s Ollama, make sure `ollama serve` is running.\n' +
46+
'If it\'s a remote API, check your network. Run `jam doctor` for the full picture.',
4847
PROVIDER_RATE_LIMITED:
49-
'You\'ve hit the provider\'s rate limit. Wait a moment and try again.\n' +
50-
'Consider switching to a local provider: `jam ask --provider ollama "your question"`',
48+
'Rate limit hit. Wait a moment and try again.\n' +
49+
'Or dodge it entirely: `jam ask --provider ollama "your question"`',
5150
PROVIDER_QUOTA_EXHAUSTED:
52-
'Your API quota is exhausted. This is NOT a transient error — retrying will not help.\n' +
53-
'Check your billing/plan at your provider\'s dashboard and add credits.\n' +
54-
'Or switch to a local provider: `jam ask --provider ollama "your question"`',
51+
'Your API quota is spent. Retrying won\'t help here.\n' +
52+
'Check your billing dashboard and add credits, or switch to local: `jam ask --provider ollama "your question"`',
5553
PROVIDER_MODEL_NOT_FOUND:
56-
'The model is not available. Check available models with: `jam models list`\n' +
57-
'For Ollama, pull the model first: `ollama pull <model-name>`',
54+
'That model doesn\'t exist. Check what\'s available: `jam models list`\n' +
55+
'For Ollama, pull it first: `ollama pull <model-name>`',
5856
PROVIDER_STREAM_ERROR:
59-
'The provider returned an unexpected response. This may be transient.\n' +
60-
'Try again, or switch providers with: `--provider <name>`',
57+
'Got an unexpected response from the provider. Might be transient.\n' +
58+
'Try again, or switch providers with `--provider <name>`.',
6159
INPUT_MISSING:
62-
'Provide input as an argument, via --file, or pipe from stdin.\n' +
60+
'No input. Pass it as an argument, via --file, or pipe from stdin.\n' +
6361
'Example: jam ask "your question" or echo "question" | jam ask',
6462
INPUT_FILE_NOT_FOUND:
65-
'The specified file does not exist. Check the path and try again.',
63+
'That file doesn\'t exist. Double-check the path.',
6664
SECRETS_UNAVAILABLE:
67-
'Secure credential storage (keytar) is not available.\n' +
65+
'Secure credential storage isn\'t available on this system.\n' +
6866
'Use environment variables instead: export ANTHROPIC_API_KEY=...',
6967
TOOL_DENIED:
70-
'The tool call was denied by your tool policy.\n' +
71-
'Adjust toolPolicy in your config or use `--yes` to auto-approve writes.',
68+
'Tool call blocked by your policy.\n' +
69+
'Adjust toolPolicy in config or use `--yes` to auto-approve writes.',
7270
TOOL_NOT_FOUND:
73-
'The requested tool does not exist. This is likely an internal error.',
71+
'That tool doesn\'t exist. This is probably a bug on our end.',
7472
TOOL_EXEC_ERROR:
75-
'A tool failed to execute. Check that git and other dependencies are installed.\n' +
76-
'Run `jam doctor` for diagnostics.',
73+
'A tool failed to execute. Make sure git and other deps are installed.\n' +
74+
'Run `jam doctor` to check your setup.',
7775
AGENT_PLAN_FAILED:
78-
'The AI could not generate a valid execution plan. Try simplifying your task or breaking it into smaller pieces.',
76+
'The model couldn\'t produce a structured plan. This usually means the model is too small for the task.\n' +
77+
'Try a larger model or simplify the instruction.',
7978
AGENT_PLAN_CYCLE:
80-
'The execution plan has circular dependencies. This is a bug — please report it.',
79+
'The plan has circular dependencies. That\'s a bug — please report it.',
8180
AGENT_WORKER_TIMEOUT:
82-
'A worker exceeded its round budget. Try increasing maxRoundsPerWorker in config.',
81+
'Worker hit its round limit. Try bumping maxRoundsPerWorker in config.',
8382
AGENT_WORKER_CANCELLED:
84-
'Worker was cancelled. This may be due to a dependency failure or user abort.',
83+
'Worker was cancelled — likely a dependency failure or user abort.',
8584
AGENT_FILE_LOCK_CONFLICT:
86-
'Two workers tried to edit the same file simultaneously. The orchestrator resolved the conflict.',
85+
'Two workers tried to edit the same file. The orchestrator sorted it out.',
8786
AGENT_FILE_LOCK_TIMEOUT:
88-
'A file lock request timed out. Another worker may be stuck.',
87+
'File lock timed out. Another worker might be stuck.',
8988
AGENT_BUDGET_EXCEEDED:
90-
'Token budget exceeded. Reduce task scope or increase maxTotal in agent config.',
89+
'Token budget exceeded. Reduce the scope or bump maxTotal in agent config.',
9190
AGENT_SANDBOX_UNAVAILABLE:
92-
'OS sandbox not available. Running with permissions-only. Run jam doctor to check.',
91+
'OS sandbox not available. Running with permissions only. Check `jam doctor`.',
9392
AGENT_RATE_LIMITED:
94-
'Provider rate limit hit. Workers paused automatically. Wait and retry.',
93+
'Provider rate limit hit. Workers paused automatically. Give it a moment.',
9594
AGENT_MERGE_CONFLICT:
96-
'Workers produced conflicting file edits. Manual resolution may be needed.',
95+
'Workers produced conflicting edits. You may need to resolve this manually.',
9796
};
9897

9998
export class JamError extends Error {

0 commit comments

Comments
 (0)