public static ModelReference resolveToModelReference(
            String paramName, Optional<String> id, Optional<String> url, Optional<String> path, Set<String> requiredTags, DeployState state) {
        if (id.isEmpty()) return createModelReference(Optional.empty(), url, path, state);
        else if (state.isHosted())
            return createModelReference(id, Optional.of(modelIdToUrl(paramName, id.get(), requiredTags)), Optional.empty(), state);
        else if (url.isEmpty() && path.isEmpty()) throw onlyModelIdInHostedException(paramName);
        else return createModelReference(id, url, path, state);
    }
@Test
    void throws_on_known_model_with_missing_tags() {
        var state = new DeployState.Builder().properties(new TestProperties().setHostedVespa(true)).build();
        var e = assertThrows(IllegalArgumentException.class, () ->
                ModelIdResolver.resolveToModelReference(
                        "param", Optional.of("minilm-l6-v2"), Optional.empty(), Optional.empty(), Set.of(HF_TOKENIZER), state));
        var expectedMsg = "Model 'minilm-l6-v2' on 'param' has tags [onnx-model] but are missing required tags [huggingface-tokenizer]";
        assertEquals(expectedMsg, e.getMessage());

        assertDoesNotThrow(
                () -> ModelIdResolver.resolveToModelReference(
                        "param", Optional.of("minilm-l6-v2"), Optional.empty(), Optional.empty(), Set.of(ONNX_MODEL), state));
    }