Skip to content
Latchkey

Artifactory virtual / remote / local repo confusion in CI

Artifactory has three repo kinds with distinct roles: local repos hold your artifacts, remote repos proxy external ones, and virtual repos aggregate both for resolution. Using the wrong kind for deploy or resolve fails.

What this error means

A deploy to a virtual or remote repo is rejected (often "Cannot deploy to a virtual repository"), or a resolve from a local-only repo misses proxied dependencies.

jf
[Error] server response: 400 Bad Request
Cannot deploy to a virtual repository 'libs-virtual'. Deploy to a local repository instead.

Common causes

Deploying to a virtual or remote repo

Virtual repos are for resolution and remote repos proxy upstreams; neither accepts direct deploys, so the write is refused.

Resolving only from a local repo

Pointing installs at a local repo misses dependencies that a virtual repo would pull from remote proxies.

How to fix it

Deploy to local, resolve through virtual

  1. Set the deploy target to a local repository.
  2. Set the resolve source to a virtual repository that aggregates local plus remote.
  3. Re-run so writes and reads use the right repo kind.
Terminal
jf npm-config --repo-resolve npm-virtual --repo-deploy npm-local

Confirm repo kinds before wiring CI

List repositories to see which are local, remote, or virtual and route deploy and resolve accordingly.

Terminal
jf rt curl -XGET "/api/repositories" | jq '.[] | {key, type}'

How to prevent it

  • Always deploy to local repos and resolve through virtual repos.
  • Never target remote or virtual repos for a deploy.
  • Name repos by kind (local/remote/virtual) to avoid mixups.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →