alibaba/nacos · error · Error
raw callInterfaces cannot be converted to a structured proto
Error message
raw callInterfaces cannot be converted to a structured protocol
What it means
Thrown by editorFromValues when the protocol editor kind is 'raw'. The function is designed to convert structured (non-raw) editor values into a StructuredProtocolEditorValues object, but raw callInterfaces are opaque user-authored JSON that cannot be decomposed back into structured fields. This is a one-way conversion: structured can serialize, raw cannot be re-structured.
Source
Thrown at console-ui-next/src/pages/newAgent/agent-console-model.ts:289
card.skills ??= [];
const seen = new Set<string>();
const declaredEndpoints = interfaces.flatMap((item) => {
const uri = String(item.url);
const transport = String(item.protocolBinding);
const key = endpointKey(uri, transport);
if (seen.has(key)) {
return [];
}
seen.add(key);
return [{ uri, transport }];
});
return { card, declaredEndpoints };
}
function editorFromValues(values: AgentEditorValues): StructuredProtocolEditorValues {
if (values.protocolEditorKind === 'raw') {
throw new Error('raw callInterfaces cannot be converted to a structured protocol');
}
return {
protocolEditorKind: values.protocolEditorKind,
agentCard: values.agentCard,
customProtocol: values.customProtocol,
customProtocolVersion: values.customProtocolVersion,
customDescriptorMediaType: values.customDescriptorMediaType,
customNativeDescriptor: values.customNativeDescriptor,
endpointSourceMode: values.endpointSourceMode,
declaredEndpoints: values.declaredEndpoints,
};
}
function buildStructuredCallInterface(
agentName: string,
version: string,
editor: StructuredProtocolEditorValues,
): AgentCallInterface {View on GitHub (pinned to 9b989acdf1)
Solutions
- Do not call editorFromValues for raw-mode values; keep the raw textarea editor active for those drafts.
- If the user wants to switch raw→structured, re-enter the data manually in the structured form rather than auto-converting.
- Guard the code path: branch on protocolEditorKind and only call editorFromValues for non-raw kinds.
Example fix
// before
const structured = editorFromValues(values); // values.protocolEditorKind === 'raw'
// after
if (values.protocolEditorKind === 'raw') {
// keep raw editor; do not convert
return;
}
const structured = editorFromValues(values); Defensive patterns
Strategy: type-guard
Validate before calling
function safeEditorFromValues(values) {
if (values.protocolEditorKind === 'raw') throw new Error('Cannot convert raw to structured; keep raw editor');
return editorFromValues(values);
} Type guard
function isStructuredKind(kind: string): boolean { return kind !== 'raw'; } Try / catch
try { editorFromValues(values); } catch (e) {
if (/cannot be converted to a structured protocol/.test(e.message)) { setEditorMode('raw'); }
} Prevention
- Branch on protocolEditorKind before conversion
- Never auto-convert raw drafts
- Let users re-enter data when switching to structured mode
When it happens
Trigger: Code path calls editorFromValues on values whose protocolEditorKind === 'raw'. This typically happens when loading an existing draft that was saved in raw mode and the UI tries to re-render it in the structured editor, or when a form-state hydration assumes structured mode.
Common situations: Switching an agent that was authored in raw JSON mode back to the structured (form-based) editor. Loading a legacy/raw draft into the structured flow.
Related errors
- protocol must be unique: ${callInterface.protocol}
- at least one protocol is required
- protocol must be unique: ${callInterface.protocol}
- at least one protocol is required
- 10000
AI-assisted analysis of alibaba/nacos@9b989acdf1 (2026-08-14).
Data as JSON: /api/errors/c9a83184a867bd08.
Report an issue: GitHub.