iflytek/astron-agent · error · Error
workflow.promptDebugger.importResponseInvalid
Error message
workflow.promptDebugger.importResponseInvalid
What it means
handleOk in WorkflowImportModal throws 'workflow.promptDebugger.importResponseInvalid' when normalizeWorkflowImportResult(value) returns falsy — the server's import response could not be interpreted as a valid workflow import payload.
Solutions
- Log/inspect the raw import response and compare with what normalizeWorkflowImportResult expects.
- Check frontend/backend version alignment for the import API schema.
- Re-export the workflow file and retry the import.
- Add a unit test for normalizeWorkflowImportResult with the actual payload shape.
Example fix
// before
const result = normalizeWorkflowImportResult(value);
if (!result) { throw new Error(t('workflow.promptDebugger.importResponseInvalid')); }
// after
console.debug('import raw response', value);
const result = normalizeWorkflowImportResult(value);
if (!result) { throw new Error(t('workflow.promptDebugger.importResponseInvalid')); } Defensive patterns
Strategy: type-guard
Validate before calling
function isImportPayload(v: unknown): v is WorkflowImportPayload {
return !!v && typeof v === 'object' && 'workflow' in (v as any);
} Type guard
function hasWorkflow(v: unknown): v is { workflow: Record<string, unknown> } {
return typeof v === 'object' && v !== null && 'workflow' in v;
} Try / catch
try {
await importWorkflow(file);
} catch (e) {
if (e.message.includes('importResponseInvalid')) {
message.error(t('workflow.promptDebugger.importResponseInvalid'));
} else { throw e; }
} Prevention
- Add schema validation (zod) on import responses.
- Keep import API contract tests between frontend and backend.
- Log raw payloads on parse failure for diagnosis.
When it happens
Trigger: The import API resolves with a value that normalizeWorkflowImportResult cannot parse (missing Workflow object, wrong shape, null data), or the request generation/mount check passed but the payload is stale/incompatible.
Common situations: Older or newer backend returning a response schema the frontend doesn't expect, uploading a file the server accepted but returned empty/partial data for, network proxy stripping the response body.
Related errors
- workflow.promptDebugger.nodeDebugRequestFailed
- space.spaceNameExists
- space.queryFailed
- ${(err as Error)?.message || '分享失败,请稍后再试~'}
- UPDATE_BOT_FAILED
AI-assisted analysis of iflytek/astron-agent@5e758547a8 (2026-09-12).
Data as JSON: /api/errors/0d334922973143ea.
Report an issue: GitHub.
Appendix: source
Thrown at console/frontend/src/components/make-creation/components/WorkflowImportModal.tsx:468
const handleOk = () => {
const file = uploadList[0]?.file;
if (!file || requestInFlightRef.current) return;
const requestGeneration = ++requestGenerationRef.current;
requestInFlightRef.current = true;
setLoading(true);
workflowImport({
file,
})
.then((value: unknown) => {
if (
!mountedRef.current ||
requestGeneration !== requestGenerationRef.current
)
return;
const result = normalizeWorkflowImportResult(value);
if (!result) {
throw new Error(
i18next.t('workflow.promptDebugger.importResponseInvalid')
);
}
// Older servers return only a Workflow and preserve the original
// behaviour. A report is shown inline so users can review unresolved
// references before opening the canvas.
if (result.report) {
setImportResult(result);
return;
}
openImportedCanvas(result, requestGeneration);
})
.catch((error: unknown) => {
if (
!mountedRef.current ||
requestGeneration !== requestGenerationRef.current
)
return;View on GitHub (pinned to 5e758547a8)