Environment
- treepplr 0.14.0
- tpplc 0.4
Bug
library(treepplr)
tp_compile_options()
#> Error in (x + 1):length(cmd_opt) : argument of length 0
Root cause
tp_compile_options <- function() {
tpplc_path <- tp_installing_treeppl()
cmd_opt <- system2(command = tpplc_path, args = "--help", ...)
x <- which(cmd_opt == "Options:")
cmd_opt <- cmd_opt[(x + 1):length(cmd_opt)]
...
It looks for a line that is exactly "Options:" in tpplc --help's output. The current tpplc 0.4--help output uses section headers "Debug options:", "Compile options:", "Runtime options:", "Inference methods:" instead — none of which match "Options:" exactly — so which() returns integer(0), and (x + 1):length(cmd_opt) becomes a nonsensical range, throwing immediately.
This function isn't called internally anywhere (compile/runtime option classification uses a hardcoded tpplcCompileOptions character vector instead), so it appears to be stale/unmaintained relative to the current CLI — but it's exported, so a user calling it directly (e.g. to discover available options) hits an immediate, confusing error with no indication that the function itself is out of date.
Suggested fix
Either update the parsing to match the current --help section headers, or deprecate/remove the function if the hardcoded tpplcCompileOptions approach is now the intended source of truth.
Environment
Bug
Root cause
It looks for a line that is exactly
"Options:"intpplc --help's output. The currenttpplc 0.4--helpoutput uses section headers"Debug options:","Compile options:","Runtime options:","Inference methods:"instead — none of which match"Options:"exactly — sowhich()returnsinteger(0), and(x + 1):length(cmd_opt)becomes a nonsensical range, throwing immediately.This function isn't called internally anywhere (compile/runtime option classification uses a hardcoded
tpplcCompileOptionscharacter vector instead), so it appears to be stale/unmaintained relative to the current CLI — but it's exported, so a user calling it directly (e.g. to discover available options) hits an immediate, confusing error with no indication that the function itself is out of date.Suggested fix
Either update the parsing to match the current
--helpsection headers, or deprecate/remove the function if the hardcodedtpplcCompileOptionsapproach is now the intended source of truth.