nexu-io/open-design · warning · Error
${field} must be a non-empty string
Error message
${field} must be a non-empty string What it means
readRequiredString is the generic guard used across the brief API (briefDraftId, nonce, requestId, and similar fields). It throws when a value is not a string or is empty, naming the offending field in the message.
Source
Thrown at apps/daemon/src/mcp-brief.ts:647
return {
completeCard: BRIEF_COPY[locale].completeCard,
confirmed: BRIEF_COPY[locale].confirmed,
continueWithBrief: BRIEF_COPY[locale].continueWithBrief,
};
}
function readProjectTitle(value: unknown): string {
if (value === undefined) return 'Untitled Open Design artifact';
const title = readRequiredString(value, 'projectTitle').trim();
if (title.length > 256) {
throw new Error('projectTitle must be at most 256 characters');
}
return title;
}
function readRequiredString(value: unknown, field: string): string {
if (typeof value !== 'string' || value.length === 0) {
throw new Error(`${field} must be a non-empty string`);
}
return value;
}
function readAnswerRecord(value: unknown, field: string): UnknownRecord {
if (value === undefined) return {};
if (!value || typeof value !== 'object' || Array.isArray(value)) {
throw new Error(`${field} must be an object`);
}
return { ...(value as UnknownRecord) };
}
function stableAnswerDigest(answers: OpenDesignBriefAnswers): string {
return JSON.stringify(
Object.entries(answers)
.sort(([left], [right]) => left.localeCompare(right))
.map(([key, value]) => [key, [...value]]),
);View on GitHub (pinned to 5be4028344)
Solutions
- Pass a non-empty string for the named field.
- If the field is optional in your flow, gate the call on its presence.
Example fix
// before
confirm_brief({ briefDraftId: undefined, nonce, answers }) // throws [366] briefDraftId
// after
confirm_brief({ briefDraftId: draft.briefDraftId, nonce, answers }) Defensive patterns
Strategy: validation
Validate before calling
function requireStr(v: unknown, name: string): string {
if (typeof v !== 'string' || v.length === 0) throw new Error(`${name} must be a non-empty string`);
return v;
} Type guard
function isNonEmptyString(v: unknown): v is string {
return typeof v === 'string' && v.length > 0;
} Prevention
- Validate required string fields before the call.
- Thread ids straight from the producing call rather than recomputing them.
- Distinguish optional vs required fields at the call site.
When it happens
Trigger: Omitting a required string field; passing undefined, null, or a number; passing an empty or whitespace-only string for a field that is not separately trimmed.
Common situations: An agent forgot to thread a field through; JSON parsed a number where a string id was expected.
Related errors
- pluginWorkflowId requires a validated externalPluginContext
- The Open Design brief is incomplete. Missing: ${missing.join
- artifactType must be one of: ${Object.keys(openDesignBriefCa
- projectTitle must be at most 256 characters
- ${field} must be an object
AI-assisted analysis of nexu-io/open-design@5be4028344 (2026-08-12).
Data as JSON: /api/errors/999e81c1f99c19f1.
Report an issue: GitHub.