{"record":{"id":"7fc2c89a14a8454b","repo":"quarkusio/quarkus","slug":"flags-are-empty","errorCode":null,"errorMessage":"Flags are empty","messagePattern":"Flags are empty","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"independent-projects/bootstrap/app-model/src/main/java/io/quarkus/bootstrap/model/ApplicationModel.java","lineNumber":61,"sourceCode":"    Iterable<ResolvedDependency> getDependencies(int flags);\n\n    /**\n     * Returns application dependencies that have any of the flags combined in the value of the {@code flags} arguments set.\n     *\n     * @param flags dependency flags to match\n     * @return application dependencies that matched the flags\n     */\n    Iterable<ResolvedDependency> getDependenciesWithAnyFlag(int flags);\n\n    /**\n     * Returns application dependencies that have any of the flags passed in as arguments set.\n     *\n     * @param flags dependency flags to match\n     * @return application dependencies that matched the flags\n     */\n    default Iterable<ResolvedDependency> getDependenciesWithAnyFlag(int... flags) {\n        if (flags.length == 0) {\n            throw new IllegalArgumentException(\"Flags are empty\");\n        }\n        int combined = flags[0];\n        for (int i = 1; i < flags.length; ++i) {\n            combined |= flags[i];\n        }\n        return getDependenciesWithAnyFlag(combined);\n    }\n\n    /**\n     * Runtime dependencies of an application\n     *\n     * @return runtime dependencies of an application\n     */\n    Collection<ResolvedDependency> getRuntimeDependencies();\n\n    /**\n     * Quarkus platforms (BOMs) found in the configuration of an application\n     *","sourceCodeStart":43,"sourceCodeEnd":79,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/independent-projects/bootstrap/app-model/src/main/java/io/quarkus/bootstrap/model/ApplicationModel.java#L43-L79","documentation":"ApplicationModel.getDependenciesWithAnyFlag(int... flags) requires at least one dependency flag because it combines the flags with bitwise OR; with zero flags the combined value would be meaningless. It throws IllegalArgumentException('Flags are empty') to fail fast on a programming mistake by the caller.","triggerScenarios":"Calling getDependenciesWithAnyFlag() with a zero-length int array, e.g. passing a dynamically built flag array that ended up empty, or AppModel metrics/capability queries built from an empty set of flags.","commonSituations":"Building flag arrays from user config or a Set<DependencyFlags> that was empty at call time; refactors where a constant flag was removed leaving an empty varargs call.","solutions":["Pass at least one DependencyFlags-derived constant, e.g. getDependenciesWithAnyFlag(DependencyFlags.RESTARTABLE).","Guard the call site: if flags.length == 0 return List.of() or skip the query instead of calling.","Check where the flags array is constructed and ensure it is seeded with a default flag."],"exampleFix":"// before\nint[] flags = collectFlags(); // may be empty\nvar deps = model.getDependenciesWithAnyFlag(flags);\n// after\nint[] flags = collectFlags();\nvar deps = flags.length == 0\n        ? List.<ResolvedDependency>of()\n        : model.getDependenciesWithAnyFlag(flags);","handlingStrategy":"validation","validationCode":"if (flags == null || flags.length == 0) {\n    throw new IllegalArgumentException(\"At least one dependency flag required\");\n}\nIterable<ResolvedDependency> deps = model.getDependenciesWithAnyFlag(flags);","typeGuard":"static boolean hasFlags(int... flags) {\n    return flags != null && flags.length > 0;\n}","tryCatchPattern":"try {\n    return model.getDependenciesWithAnyFlag(flags);\n} catch (IllegalArgumentException e) {\n    if (\"Flags are empty\".equals(e.getMessage())) {\n        return List.of();\n    }\n    throw e;\n}","preventionTips":["Seed flag arrays with a default flag such as DependencyFlags.RUNTIME.","Never pass raw empty Sets converted to varargs without a length check.","Prefer the int (combined) overload when combining flags manually."],"tags":["application-model","flags","illegal-argument"],"backgroundTag":"empty-flags-argument","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}