apolloconfig/apollo · error · ServiceException

import config error.

Error message

import config error.

What it means

Thrown by ConfigsImportService.importDataFromZipFile() as a catch-all ServiceException wrapping any Exception raised during doImport(). The doImport method runs parallel imports of apps, app namespaces, clusters, and namespaces using parallelStream and CountDownLatch. Any failure in those import sub-tasks propagates up as this generic error, logged with the full exception stack trace.

Source

Thrown at apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/service/ConfigsImportService.java:164

              // namespace file.path format :
              // apollo/${appId}/${env}/${appId}+${cluster}+${namespaceName}
              toImportNSs.add(new ImportNamespaceData(Env.valueOf(env), fileName, content,
                  ignoreConflictNamespace));
            }
          }
        }
      }
    }

    try {
      LOGGER.info("Import data. app = {}, appns = {}, cluster = {}, namespace = {}",
          toImportApps.size(), toImportAppNSs.size(), toImportClusters.size(), toImportNSs.size());

      doImport(importEnvs, toImportApps, toImportAppNSs, toImportClusters, toImportNSs, operator);

    } catch (Exception e) {
      LOGGER.error("import config error.", e);
      throw new ServiceException("import config error.", e);
    }
  }

  /**
   * import all configurations of an application in a specified environment and cluster
   */
  public void importAppConfigFromZipFile(String appId, Env env, String clusterName,
      ZipInputStream dataZip, boolean ignoreConflictNamespace, String operator) throws IOException {
    ClusterDTO clusterDTO = clusterService.loadCluster(appId, env, clusterName);
    if (clusterDTO == null) {
      throw new BadRequestException(
          "The app does not exist in the specified environment and cluster.");
    }

    List<ImportNamespaceData> toImportNSs = Lists.newArrayList();
    ZipEntry entry;
    while ((entry = dataZip.getNextEntry()) != null) {
      if (entry.isDirectory()) {

View on GitHub (pinned to d95fc18d11)

Solutions

  1. Examine the portal logs for the preceding 'import config error.' line which contains the full stack trace of the root cause.
  2. If the cause is a namespace conflict, retry with ignoreConflictNamespace=true or resolve the conflict manually.
  3. Verify all target environments in importEnvs are reachable and their config/admin services are healthy.
  4. Check for duplicate app or appnamespace names between the zip and the target portal database.
Defensive patterns

Strategy: try-catch

Validate before calling

// Pre-check: verify target envs are reachable and check for obvious conflicts
for (Env env : importEnvs) {
  if (!envService.isEnvValid(env)) {
    throw new IllegalStateException("Target env not reachable: " + env);
  }
}

Try / catch

try {
  configsImportService.importDataFromZipFile(envs, zipStream, ignoreConflict, operator);
} catch (ServiceException e) {
  log.error("Full data import failed", e);
  if (ignoreConflict == false && e.getCause() != null) {
    log.warn("Consider retrying with ignoreConflictNamespace=true after review");
  }
  throw e;
}

Prevention

When it happens

Trigger: Calling the full data import API (importDataFromZipFile) where any sub-import fails: an app already exists with conflicting data, a namespace conflict when ignoreConflictNamespace is false, the admin/config service is unreachable, or a database constraint violation occurs during parallel import.

Common situations: Importing a zip exported from a different Apollo environment where app/namespace IDs conflict; target env config service down; database unique constraint violation on appnamespace name; race condition in parallel import causing duplicate key.

Related errors


AI-assisted analysis of apolloconfig/apollo@d95fc18d11 (2026-08-14). Data as JSON: /api/errors/0da95bd3c0b10c1c. Report an issue: GitHub.