Skip to main content
This page covers all error conditions you may encounter when integrating FlowDrop: mount exceptions, API errors during operation, and Agent Spec validation failures.

Mount API exceptions

mountFlowDropApp() throws synchronously if the mount cannot proceed.
Error messageCauseFix
Container element not foundThe selector or element passed to container does not exist in the DOMEnsure the container element exists before calling mountFlowDropApp()
Container has no dimensionsThe container element has zero width or heightApply width and height (or min-height) to the container via CSS before mounting
FlowDrop CSS not importedThe base styles from @flowdrop/flowdrop/styles were not loadedImport @flowdrop/flowdrop/styles before mounting
Cannot mount in server-side contextmountFlowDropApp() was called during SSR (no window object)Guard the call with if (typeof window !== 'undefined') — see Framework Integration
// Safe mount pattern
if (typeof window !== 'undefined') {
  const app = await mountFlowDropApp(document.getElementById('editor'), {
    // ...options
  });
}

API error handling

FlowDrop calls your REST API during normal operation. Use the onApiError event handler to intercept these errors.
const app = await mountFlowDropApp(document.getElementById('editor'), {
  endpointConfig: createEndpointConfig('/api/flowdrop'),
  eventHandlers: {
    onApiError: (error, operation) => {
      // error.message — error description
      // operation     — what FlowDrop was doing when the error occurred

      if (error.status === 401) {
        // Redirect to login
        window.location.href = '/login';
        return true; // return true to suppress the default toast notification
      }

      // Return false (or nothing) to show the default error toast
      return false;
    }
  }
});

HTTP status codes

StatusCauseRecommended action
0Network error — no response receivedCheck server is running; show connectivity warning
401Unauthorized — missing or expired credentialsRedirect to login or refresh token
403Forbidden — authenticated but not allowedShow permission error; do not redirect
404Endpoint not found — wrong URL configuredVerify your endpoint configuration
422Validation error — malformed workflow JSONLog the response body for details
500Server errorLog and surface to user; offer retry

operation values

The operation argument tells you what FlowDrop was doing when the error occurred:
ValueTrigger
loadNodesInitial GET /nodes request on mount
loadWorkflowGET /workflows/:id on mount
saveWorkflowPOST /workflows or PUT /workflows/:id on save
loadPortConfigGET /port-config for dynamic port compatibility
executeWorkflowPOST /execute (if using the playground)

Save errors

onSaveError is a separate handler called when a save operation fails. It receives the workflow object that failed to save, allowing you to recover or retry.
const app = await mountFlowDropApp(document.getElementById('editor'), {
  eventHandlers: {
    onSaveError: async (error, workflow) => {
      console.error('Save failed:', error);
      // workflow is the workflow object that failed to persist
      // You can store it locally or retry:
      localStorage.setItem('flowdrop-save-fallback', JSON.stringify(workflow));
    }
  }
});

Agent Spec validation errors

When exporting a workflow to Agent Spec format via WorkflowOperationsHelper.exportAsAgentSpec(), the result object indicates success or failure:
const result = WorkflowOperationsHelper.exportAsAgentSpec(workflow);
// result: { valid: boolean, errors: string[], warnings: string[] }

if (!result.valid) {
  console.error('Export failed:', result.errors);
}

Common validation errors

Error messageCauseFix
Workflow has no nodesThe workflow is emptyAdd at least one node before exporting
Cycle detectedThe workflow graph contains a loopRemove cyclic connections; Agent Spec requires a DAG
Node type not mappable: <type>A custom node type has no Agent Spec equivalentMap custom types to Agent Spec actions in your export config
Disconnected node: <id>A node has no edgesConnect all nodes or remove unused ones
Missing required port: <port>A required input port has no incoming edgeConnect the required port before exporting
Warnings (non-fatal) indicate information that may be lost in the export, such as FlowDrop-specific configuration fields that have no Agent Spec equivalent.