Description
harbor project robot list logs errors from project lookup or robot listing but continues execution. This can cause a nil pointer panic instead of returning a clean CLI error.
The issue is in cmd/harbor/root/project/robot/list.go.
Steps to Reproduce
- Run the command with an invalid or inaccessible project name:
harbor project robot list does-not-exist
2.Or trigger an API error while listing robots for a project.
3. Observe that the command can continue after the error and dereference a nil/invalid response.
Expected Behavior
The command should return immediately with a clear error message, for example:
failed to get project: <harbor error>
The CLI should exit with a non-zero status without panicking.
Actual Behavior
The command logs the error but continues execution.
Relevant code:
project, err := api.GetProject(args[0], false)
if err != nil {
log.Errorf("Invalid Project Name: %v", err)
}
opts.ProjectID = int64(project.Payload.ProjectID)
If api.GetProject() fails, project.Payload may be nil and the command can panic.
A similar pattern exists after api.ListRobot(opts):
robots, err := api.ListRobot(opts)
if err != nil {
log.Errorf("failed to get robots list: %v", err)
}
list.ListRobots(robots.Payload)
Environment
- OS: Fedora linux
- Tool version:
- Other relevant details:
Additional Context
Command Run:
env XDG_CONFIG_HOME=/tmp/harbor-cli-verify/config \
XDG_DATA_HOME=/tmp/harbor-cli-verify/data \
./harbor-cli project robot list does-not-exist
observed output:

Description
harbor project robot listlogs errors from project lookup or robot listing but continues execution. This can cause a nil pointer panic instead of returning a clean CLI error.The issue is in
cmd/harbor/root/project/robot/list.go.Steps to Reproduce
2.Or trigger an API error while listing robots for a project.
3. Observe that the command can continue after the error and dereference a nil/invalid response.
Expected Behavior
The command should return immediately with a clear error message, for example:
The CLI should exit with a non-zero status without panicking.
Actual Behavior
The command logs the error but continues execution.
Relevant code:
If api.GetProject() fails, project.Payload may be nil and the command can panic.
A similar pattern exists after api.ListRobot(opts):
Environment
Additional Context
Command Run:
env XDG_CONFIG_HOME=/tmp/harbor-cli-verify/config \ XDG_DATA_HOME=/tmp/harbor-cli-verify/data \ ./harbor-cli project robot list does-not-existobserved output: