Skip to content

Invalid CLI arguments parsing #197

@tbohdans

Description

@tbohdans

Docker version 24.0.7, build afdd53b4e3

Docker inspect output: sha256:dec52f5809f73e582982d8ce945cce4fc7003bbe5305915c7f245fce9c0b4d48 [fluree/server:latest] 2024-05-02T03:51:46.513448374Z

Docker OS/Architecture: linux/aarch64

OS: Darwin Mac.lan 24.5.0 Darwin Kernel Version 24.5.0: Tue Apr 22 19:54:43 PDT 2025; root:xnu-11417.121.6~2/RELEASE_ARM64_T8132 arm64

I ran same docker run command as in docs "Configure Fluree Server" and faced the issue:

docker run -p 58090:8090 -v `pwd`/data:/opt/fluree-server/data -v `pwd`/resources:/opt/fluree-server/resources fluree/server:latest --profile="docker" --config="./resources/config.jsonld"

08:51:29.216 [main] INFO  fluree.server.main - Starting fluree/server with profile: :--profile=docker
Exception in thread "main" java.lang.IllegalArgumentException: No method in multimethod 'named-system' for dispatch value: :--profile=docker
        at clojure.lang.MultiFn.getFn(MultiFn.java:156)
        at clojure.lang.MultiFn.invoke(MultiFn.java:229)
        at donut.system$system.invokeStatic(system.cljc:759)
        at donut.system$system.invoke(system.cljc:754)
        at donut.system$start.invokeStatic(system.cljc:770)
        at donut.system$start.invoke(system.cljc:768)
        at fluree.server.main$_main.invokeStatic(main.clj:137)
        at fluree.server.main$_main.doInvoke(main.clj:124)
        at clojure.lang.RestFn.applyTo(RestFn.java:137)
        at fluree.server.main.main(Unknown Source)

I've tried to pass different variations of arguments, but result the same - CLI parses first word as --profile parameter

Then I cloned server repo and tried to fix it by adding args preprocessing function in command.clj

(defn preprocess-args [args]
  (mapcat (fn [arg]
            (if (and (string? arg)
                     (.startsWith arg "--")
                     (.contains arg "="))
              (let [[k v] (.split arg "=" 2)]
                [k v])
              [arg]))
          args))

Then added it to the parse function

(defn parse
  [args]
  (-> args
      preprocess-args
      (cli/parse-opts cli-options)
      validate-opts))

Then built docker image and ran it. Problem seems to be solved.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions