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

  1. Log/inspect the raw import response and compare with what normalizeWorkflowImportResult expects.
  2. Check frontend/backend version alignment for the import API schema.
  3. Re-export the workflow file and retry the import.
  4. 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

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


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)