different-ai/openwork · error
Failed to create the imported plugin.
Error message
Failed to create the imported plugin.
What it means
createImportedPlugin in plugin-editor-screen.tsx throws this fixed message when the import-and-create POST (30s timeout) returns a non-ok response. Unlike the generic postJson path, no status is interpolated, so the server payload attached by getRequestError is the key diagnostic. Means the Den API failed to materialize a plugin from the import draft.
Source
Thrown at ee/apps/den-web/app/(den)/dashboard/_components/plugin-editor-screen.tsx:215
access: {
orgWide: shareOrgWide,
memberIds: shareOrgWide || !orgContext ? [] : [orgContext.currentMember.id],
teamIds: [],
},
authType: draft.authType,
credentialMode: draft.credentialMode,
description: description.trim() || null,
githubUrl: draft.githubUrl,
marketplaceId: marketplaceId || undefined,
name: name.trim(),
selectedSkillKeys: draft.selectedSkillKeys,
selectedServerKeys: draft.selectedServerKeys,
}),
},
30000,
);
if (!result.response.ok) {
throw getRequestError(result.payload, result.response, "Failed to create the imported plugin.");
}
const item = isRecord(result.payload) && isRecord(result.payload.item) ? result.payload.item : null;
const plugin = item && isRecord(item.plugin) ? item.plugin : null;
pluginId = plugin && typeof plugin.id === "string" ? plugin.id : null;
});
if (!pluginId) throw new Error("The plugin was created, but no id was returned.");
clearPluginImportDraft();
await queryClient.invalidateQueries({ queryKey: pluginQueryKeys.all });
router.push(getPluginRoute(orgSlug, pluginId));
router.refresh();
} catch (error) {
setSaveError(error instanceof Error ? error.message : "Failed to create the imported plugin.");
} finally {
setSaving(false);
}
}
View on GitHub (pinned to 2b7df46e8a)
Solutions
- Re-run the import preview (previewImport) to refresh valid server keys before retrying the create.
- Reduce the draft scope: deselect unavailable/errored server keys and retry.
- For 401/403, re-authenticate or confirm import permission in the org.
- If 502/504, verify the GitHub source URL is public/reachable and retry later.
Example fix
// before: create straight from stale draft await createImportedPlugin(draft); // after: refresh selection against a fresh preview const preview = await previewImport(draft.githubUrl); draft.selectedServerKeys = draft.selectedServerKeys.filter((k) => preview.serverKeys.includes(k)); await createImportedPlugin(draft);
Defensive patterns
Strategy: try-catch
Validate before calling
if (!draft.githubUrl) throw new Error('Run the GitHub import preview first.');
if (!draft.selectedServerKeys?.length) throw new Error('Select at least one server key to import.'); Type guard
function hasSelectedKeys(v: unknown): v is { selectedServerKeys: string[] } {
return typeof v === 'object' && v !== null &&
Array.isArray((v as Record<string, unknown>).selectedServerKeys) &&
((v as { selectedServerKeys: unknown[] }).selectedServerKeys.length > 0);
} Try / catch
try {
const id = await createImportedPlugin(draft);
if (!id) throw new Error('The plugin was created, but no id was returned.');
} catch (e) {
await refreshImportPreview();
toast(e instanceof Error ? e.message : String(e));
} Prevention
- Always run the import preview immediately before create so server keys are current.
- Filter selectedServerKeys against the preview result before submitting.
- Break very large imports into smaller selections to stay under the 30s timeout.
- Verify the GitHub source is public/reachable before starting an import.
When it happens
Trigger: The import-create POST with the serialized draft (including selectedServerKeys) returns 4xx/5xx: empty or invalid selectedServerKeys (400), GitHub source unreachable server-side (502), permission denied (403), or import size/timeout limits hit (413/504).
Common situations: Importing a GitHub plugin whose repo is private or rate-limited; selecting server keys that were removed from the org; importing a very large plugin manifest that exceeds the 30s window.
Related errors
- Failed to preview GitHub plugin components.
- request_failed
- plugin_ref_not_found
- invalid_payload
- Failed to load desktop policies (${response.status}).
AI-assisted analysis of different-ai/openwork@2b7df46e8a (2026-09-01).
Data as JSON: /api/errors/7fd5a39161697c4c.
Report an issue: GitHub.