[api] do not crash when refering to a not existing repository