apache/incubator-seata · error · IllegalArgumentException

name can't be null

Error message

name can't be null

What it means

FileConfiguration.getConfigFile(name) throws IllegalArgumentException("name can't be null") when asked to resolve a config file whose name is null. The method locates files from the filesystem or classpath (with an optional 'file:' prefix); a null name means the caller asked which file corresponds to no configuration and is rejected up front.

Solutions

  1. Pass an explicit file name (commonly 'file.conf' or 'registry.conf').
  2. Default the name when reading from properties: name == null ? 'file.conf' : name.
  3. Check that the seata.config.name JVM property / env var you rely on is actually set at runtime.

Example fix

// before
File f = getConfigFile(fileName);

// after
File f = getConfigFile(fileName != null ? fileName : DEFAULT_FILE_NAME);
Defensive patterns

Strategy: validation

Validate before calling

if (name == null || name.trim().isEmpty()) {
    name = "file.conf"; // or fail fast with a descriptive error
}

Prevention

When it happens

Trigger: Passing a null name directly, or a derived name being null — e.g. ConfigurationFactory asking for the config file from a system property (seata.config.name / property such as file.conf name) that was set to an empty/absent value and normalized to null.

Common situations: Programmatic bootstrap where the config-file name property is optional and unset; wrappers calling getConfigFile with a value read from an unpopulated map; tests constructing FileConfiguration without a name argument path.

Related errors


AI-assisted analysis of apache/incubator-seata@e01f97c6db (2026-08-14). Data as JSON: /api/errors/88620d2d505ba106. Report an issue: GitHub.

Appendix: source

Thrown at config/seata-config-core/src/main/java/org/apache/seata/config/FileConfiguration.java:137

            this.allowDynamicRefresh = allowDynamicRefresh;
            if (LOGGER.isDebugEnabled()) {
                LOGGER.debug("The file name of the operation is {}", name);
            }
        }
        this.name = name;
        configOperateExecutor = new ThreadPoolExecutor(
                CORE_CONFIG_OPERATE_THREAD,
                MAX_CONFIG_OPERATE_THREAD,
                Integer.MAX_VALUE,
                TimeUnit.MILLISECONDS,
                new LinkedBlockingQueue<>(),
                new NamedThreadFactory("configOperate", MAX_CONFIG_OPERATE_THREAD));
    }

    private File getConfigFile(String name) {
        try {
            if (name == null) {
                throw new IllegalArgumentException("name can't be null");
            }

            boolean filePathCustom = name.startsWith(SYS_FILE_RESOURCE_PREFIX);
            String filePath = filePathCustom ? name.substring(SYS_FILE_RESOURCE_PREFIX.length()) : name;
            String decodedPath = URLDecoder.decode(filePath, StandardCharsets.UTF_8.name());
            File targetFile = getFileFromFileSystem(decodedPath);
            if (targetFile != null) {
                return targetFile;
            }

            if (!filePathCustom) {
                targetFile = getFileFromClasspath(name);
                if (targetFile != null) {
                    return targetFile;
                }
            }
        } catch (UnsupportedEncodingException e) {
            LOGGER.error("decode name error: {}", e.getMessage(), e);

View on GitHub (pinned to e01f97c6db)