{"record":{"id":"adac6a8f6c639200","repo":"apolloconfig/apollo","slug":"import-app-config-error","errorCode":null,"errorMessage":"import app config error.","messagePattern":"import app config error\\.","errorType":"exception","errorClass":"ServiceException","httpStatus":500,"severity":"error","filePath":"apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/service/ConfigsImportService.java","lineNumber":219,"sourceCode":"          || !fileName.startsWith(fileNamePrefix)) {\n        throw new BadRequestException(\"The content of the file to be imported is incorrect.\");\n      }\n      if (!fileName.endsWith(ConfigFileUtils.CLUSTER_METADATA_FILE_SUFFIX)) {\n        toImportNSs.add(new ImportNamespaceData(env, fileName, content, ignoreConflictNamespace));\n      }\n    }\n\n    if (CollectionUtils.isEmpty(toImportNSs)) {\n      throw new BadRequestException(\"The configuration to be imported is empty.\");\n    }\n\n    try {\n      LOGGER.info(\"Import namespace. namespace = {}\", toImportNSs.size());\n      doImport(Lists.newArrayList(), Lists.newArrayList(), Lists.newArrayList(),\n          Lists.newArrayList(), toImportNSs, operator);\n    } catch (Exception e) {\n      LOGGER.error(\"import app config error.\", e);\n      throw new ServiceException(\"import app config error.\", e);\n    }\n  }\n\n  private void doImport(List<Env> importEnvs, List<String> toImportApps,\n      List<String> toImportAppNSs, List<ImportClusterData> toImportClusters,\n      List<ImportNamespaceData> toImportNSs, String operator) throws InterruptedException {\n    LOGGER.info(\"Start to import app. size = {}\", toImportApps.size());\n\n    long startTime = System.currentTimeMillis();\n    CountDownLatch appLatch = new CountDownLatch(toImportApps.size());\n    toImportApps.parallelStream().forEach(app -> {\n      try {\n        importApp(app, importEnvs, operator);\n      } catch (Exception e) {\n        LOGGER.error(\"import app error. app = {}\", app, e);\n      } finally {\n        appLatch.countDown();\n      }","sourceCodeStart":201,"sourceCodeEnd":237,"githubUrl":"https://github.com/apolloconfig/apollo/blob/d95fc18d112589efc09ddcbe1507047584d55251/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/service/ConfigsImportService.java#L201-L237","documentation":"Thrown as a ServiceException by ConfigsImportService.importAppConfigFromZipFile() wrapping any Exception raised during doImport() of the collected namespace data. This is the single-app equivalent of error 184: after successfully parsing all zip entries, the actual import (creation/update of namespaces and items) fails. The root cause is logged with full stack trace.","triggerScenarios":"Calling importAppConfigFromZipFile where doImport fails: namespace conflict when ignoreConflictNamespace is false, admin/config service unreachable, database constraint violation, or item validation failure during the parallel import.","commonSituations":"Namespace already exists with different items and ignoreConflictNamespace is false; target config service is down; database unique constraint on namespace name; item key validation failure (duplicate keys, invalid characters).","solutions":["Examine portal logs for the 'import app config error.' line containing the root cause stack trace.","If the cause is a namespace conflict, retry with ignoreConflictNamespace=true.","Verify the target environment's admin/config service is reachable and healthy.","Check for duplicate item keys or invalid item values in the imported namespace data."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  configsImportService.importAppConfigFromZipFile(appId, env, clusterName, zip, ignoreConflict, operator);\n} catch (ServiceException e) {\n  log.error(\"App config import failed during doImport\", e);\n  if (!ignoreConflict && e.getCause() != null) {\n    log.warn(\"Retry with ignoreConflictNamespace=true after reviewing conflicts\");\n  }\n  throw e;\n}","preventionTips":["Check for existing namespaces with the same name before importing.","Verify the target environment's admin service is healthy.","Review item data in the zip for duplicate keys or invalid values."],"tags":["apollo-portal","config-import","namespace","service-exception","parallel-import"],"backgroundTag":null,"analyzedSha":"d95fc18d112589efc09ddcbe1507047584d55251","analyzedAt":"2026-08-14T04:00:05.477Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}