Skip to content

FW_IMPORT_PLUGINS_FAILED: concurrent plugin installs race on adapt.json #157

@taylortom

Description

@taylortom

Summary

During course import, importCoursePlugins() installs plugins concurrently via Promise.all (line 665).

Each plugin install calls adapt-cli installPlugins, which after a successful install reads adapt.json to update the manifest.

When multiple installs run concurrently, they race on reading/writing this file, causing TypeError: Cannot read properties of undefined (reading 'dependencies').

Error

Error: FW_IMPORT_PLUGINS_FAILED
    at AdaptFrameworkImport.importCoursePlugins (AdaptFrameworkImport.js:696)

With underlying per-plugin errors:

warn contentplugin PLUGIN_INSTALL_FAIL adapt-close TypeError: Cannot read properties of undefined (reading 'dependencies')
    at Project.getManifestDependencies (adapt-cli/lib/integration/Project.js:65)
    at install (adapt-cli/lib/integration/PluginManagement/install.js:46)

Root Cause

  1. AdaptFrameworkImport.js:665 runs Promise.all(plugins.map(...)) — concurrent plugin installs
  2. Each calls adapt-cli installPluginsinstall() in install.js
  3. After install, line 46 of install.js calls project.getManifestDependencies()
  4. getManifestDependencies() calls readValidateJSON(adapt.json) which reads the adapt.json manifest
  5. readValidateJSON has a bug: if the file read fails (e.g. concurrent write), the catch block returns undefined instead of re-throwing
  6. manifest.dependencies on undefined → TypeError

This is a pre-existing issue (observed on Feb 20 before the utility extraction work). The specific plugins that fail vary between runs due to the non-deterministic nature of the race condition.

Possible Fixes

In adaptframework (workaround):

  • Serialize plugin installs: change Promise.all to sequential execution at line 665

In adapt-cli (root cause):

  • See adapt-security/adapt-cli issue (linked below) — readValidateJSON should re-throw on error, and getManifestDependencies should handle missing dependencies gracefully

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions