Skip to content

Commit 80547f8

Browse files
[Inference API] Fix unique ID message for inference ID matches trained model ID (#119543)
* fix unique ID message for inference ID matches trained model ID * Update docs/changelog/119543.yaml * update test to match fix
1 parent 12eb1cf commit 80547f8

File tree

4 files changed

+13
-3
lines changed

4 files changed

+13
-3
lines changed

docs/changelog/119543.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
pr: 119543
2+
summary: "[Inference API] Fix unique ID message for inference ID matches trained model\
3+
\ ID"
4+
area: Machine Learning
5+
type: bug
6+
issues:
7+
- 111312

x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/job/messages/Messages.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,8 @@ public final class Messages {
281281
public static final String FIELD_CANNOT_BE_NULL = "Field [{0}] cannot be null";
282282
public static final String MODEL_ID_MATCHES_EXISTING_MODEL_IDS_BUT_MUST_NOT =
283283
"Model IDs must be unique. Requested model ID [{}] matches existing model IDs but must not.";
284+
public static final String INFERENCE_ID_MATCHES_EXISTING_MODEL_IDS_BUT_MUST_NOT =
285+
"Inference endpoint IDs must be unique. Requested inference endpoint ID [{}] matches existing trained model ID(s) but must not.";
284286
public static final String MODEL_ID_DOES_NOT_MATCH_EXISTING_MODEL_IDS_BUT_MUST_FOR_IN_CLUSTER_SERVICE =
285287
"Requested model ID [{}] does not have a matching trained model and thus cannot be updated.";
286288
public static final String INFERENCE_ENTITY_NON_EXISTANT_NO_UPDATE = "The inference endpoint [{}] does not exist and cannot be updated";

x-pack/plugin/inference/src/main/java/org/elasticsearch/xpack/inference/action/TransportPutInferenceModelAction.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ protected void masterOperation(
153153
if ((assignments == null || assignments.isEmpty()) == false) {
154154
listener.onFailure(
155155
ExceptionsHelper.badRequestException(
156-
Messages.MODEL_ID_MATCHES_EXISTING_MODEL_IDS_BUT_MUST_NOT,
156+
Messages.INFERENCE_ID_MATCHES_EXISTING_MODEL_IDS_BUT_MUST_NOT,
157157
request.getInferenceEntityId()
158158
)
159159
);

x-pack/plugin/ml/qa/ml-inference-service-tests/src/javaRestTest/java/org/elasticsearch/xpack/ml/integration/ModelIdUniquenessIT.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,10 @@ public void testPutInferenceModelFailsWhenTrainedModelWithIdAlreadyExists() thro
2929
assertThat(
3030
e.getMessage(),
3131
Matchers.containsString(
32-
"Model IDs must be unique. Requested model ID [" + modelId + "] matches existing model IDs but must not."
32+
"Inference endpoint IDs must be unique. Requested inference endpoint ID ["
33+
+ modelId
34+
+ "] matches existing trained model ID(s) but must not."
3335
)
34-
3536
);
3637
}
3738

0 commit comments

Comments
 (0)