Describe the bug
In pkg/watcher/executor.go at line 15, the error returned by config.DefaultLocalConfigPath() is "handled" with:
fmt.Errorf("Error while loading config: %s", err.Error())
fmt.Errorf returns an error value — it does not print anything to the console. Because the return value is never assigned or checked, the error is silently discarded. The function then continues execution with a zero-value cfgPath (empty string ""), which is passed to os.Stat(""). This always fails, causing the code to silently fall through to the else branch, where it incorrectly uses raw context strings as server URLs instead of reading them from the local config file.
Expected behavior
If the local config path cannot be resolved, TriggerImport should log a clear, visible warning (e.g., via log.Printf) and return early, so the developer can see exactly why re-imports are failing.
Actual behavior
The error is completely swallowed with no output. The watcher continues with cfgPath = "", falls through to the fallback branch, and attempts connections to incorrect URLs. The developer sees only a cryptic downstream connection error with no indication that the root cause is a config-path resolution failure.
How to Reproduce?
Reproducer:
Resources to reproduce the behavior:
- Start the file watcher via
microcks import --watch.
- While the watcher is running, corrupt or remove
~/.microcks/config (or set $HOME to a non-existent path).
- Modify a watched API specification file to trigger a re-import.
- Observe: no error message is printed about the config failure, but the import fails with a connection error to an incorrect URL.
Microcks version or git rev
master (commit cfe2267)
Install method (docker-compose, helm chart, operator, docker-desktop extension,...)
(docker-compose, helm chart, operator, docker-desktop extension,...) CLI Binary (built from source via make build-local)
Additional information
The fix is a 3-line change: replace fmt.Errorf(...) with log.Printf("[ERROR] ...") and add a return statement to abort the function early when the config path cannot be resolved. I would like to work on this fix if the maintainers agree with the approach.
Describe the bug
In
pkg/watcher/executor.goat line 15, the error returned byconfig.DefaultLocalConfigPath()is "handled" with:fmt.Errorfreturns an error value — it does not print anything to the console. Because the return value is never assigned or checked, the error is silently discarded. The function then continues execution with a zero-valuecfgPath(empty string""), which is passed toos.Stat(""). This always fails, causing the code to silently fall through to theelsebranch, where it incorrectly uses raw context strings as server URLs instead of reading them from the local config file.Expected behavior
If the local config path cannot be resolved,
TriggerImportshould log a clear, visible warning (e.g., vialog.Printf) and return early, so the developer can see exactly why re-imports are failing.Actual behavior
The error is completely swallowed with no output. The watcher continues with
cfgPath = "", falls through to the fallback branch, and attempts connections to incorrect URLs. The developer sees only a cryptic downstream connection error with no indication that the root cause is a config-path resolution failure.How to Reproduce?
Reproducer:
Resources to reproduce the behavior:
microcks import --watch.~/.microcks/config(or set$HOMEto a non-existent path).Microcks version or git rev
master(commitcfe2267)Install method (
docker-compose,helm chart,operator,docker-desktop extension,...)(
docker-compose,helm chart,operator,docker-desktop extension,...) CLI Binary (built from source viamake build-local)Additional information
The fix is a 3-line change: replace
fmt.Errorf(...)withlog.Printf("[ERROR] ...")and add areturnstatement to abort the function early when the config path cannot be resolved. I would like to work on this fix if the maintainers agree with the approach.