can1357/oh-my-pi · error
Generated systemPrompt is empty
Error message
Generated systemPrompt is empty
What it means
parseGeneratedAgentSpec requires a non-empty systemPrompt in the LLM-generated agent spec. The systemPrompt is the body of the generated agent .md file; an empty one would produce a useless agent. This is a guard against the architect model returning a blank or missing systemPrompt field.
Source
Thrown at packages/coding-agent/src/modes/components/agents-hub.ts:194
}
if (
typeof parsed.identifier !== "string" ||
typeof parsed.whenToUse !== "string" ||
typeof parsed.systemPrompt !== "string"
) {
throw new Error("Model output is missing required fields (identifier, whenToUse, systemPrompt)");
}
const identifier = parsed.identifier.trim();
const whenToUse = parsed.whenToUse.trim();
const systemPrompt = parsed.systemPrompt.trim();
if (!IDENTIFIER_PATTERN.test(identifier)) {
throw new Error("Generated identifier is invalid (must be lowercase kebab-case, 2+ words)");
}
if (!whenToUse.toLowerCase().startsWith("use this agent when")) {
throw new Error("Generated whenToUse must start with 'Use this agent when...'");
}
if (!systemPrompt) {
throw new Error("Generated systemPrompt is empty");
}
return { identifier, whenToUse, systemPrompt };
}
function matchAgent(agent: HubAgent, query: string): boolean {
const text = `${agent.name} ${agent.description} ${SOURCE_LABEL[agent.source]} ${agent.overrideModel ?? ""}`;
return query
.trim()
.split(/\s+/)
.every(token => fuzzyMatch(token, text).matches);
}
/**
* The fullscreen agents hub component. Hosted via
* `ui.showOverlay(..., { fullscreen: true })`; the host must call
* {@link AgentsHubComponent.dispose} when the overlay closes.
*/
export class AgentsHubComponent implements Component {View on GitHub (pinned to 9690622007)
Solutions
- Re-run agent creation so the model regenerates a complete spec
- Check the model's raw response (truncation or formatting) and retry with a larger max-tokens budget
- Use a stronger model that reliably fills every required field
- Enter the agent definition manually instead of via the creation architect
Example fix
// before systemPrompt: "" // after systemPrompt: "You are a refactoring assistant. Review code and apply safe transformations."
Defensive patterns
Strategy: validation
Validate before calling
const systemPrompt = (parsed.systemPrompt ?? "").trim();
if (!systemPrompt) throw new Error("systemPrompt is empty"); Type guard
function hasSystemPrompt(s: unknown): s is { systemPrompt: string } {
return typeof s === "object" && s !== null && typeof (s as any).systemPrompt === "string" &&
(s as any).systemPrompt.trim().length > 0;
} Try / catch
try {
const spec = await hub.runAgentCreationArchitect(desc);
} catch (err) {
if (err instanceof Error && err.message === "Generated systemPrompt is empty") {
// retry once or fall back to manual authoring
} else throw err;
} Prevention
- Ensure the architect model has enough max-tokens for the full spec
- Check raw model output when creation fails repeatedly
- Prefer models that reliably complete multi-section outputs
- Author agents manually when LLM generation is flaky
When it happens
Trigger: The architect LLM's response parses to a spec whose systemPrompt trims to an empty string — e.g. the model emitted only the identifier/whenToUse, or a malformed block caused the systemPrompt capture to be empty.
Common situations: Model output truncated by token limits; model omitting the systemPrompt section; regex/parser section boundaries mismatching the model's formatting; blank-line-only prompt body.
Related errors
- Model output is not a JSON object
- Model output is missing required fields (identifier, whenToU
- Generated identifier is invalid (must be lowercase kebab-cas
- Generated whenToUse must start with 'Use this agent when...'
- Invalid commit type: ${input.type}
AI-assisted analysis of can1357/oh-my-pi@9690622007 (2026-08-31).
Data as JSON: /api/errors/d38e9d3e30bd3507.
Report an issue: GitHub.