{"record":{"id":"1f6989c65842bae2","repo":"eclipse-vertx/vert.x","slug":"unmodifiable-stream-priority","errorCode":null,"errorMessage":"Unmodifiable stream priority","messagePattern":"Unmodifiable stream priority","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"vertx-core/src/main/java/io/vertx/core/http/impl/HttpUtils.java","lineNumber":195,"sourceCode":"      if (index == 0) {\n        return \"http.response.status_code\";\n      }\n      throw new IndexOutOfBoundsException(\"Invalid tag index \" + index);\n    }\n\n    @Override\n    public String value(HttpResponse resp, int index) {\n      if (index == 0) {\n        return Integer.toString(resp.statusCode());\n      }\n      throw new IndexOutOfBoundsException(\"Invalid tag index \" + index);\n    }\n  };\n\n  public static final StreamPriority DEFAULT_STREAM_PRIORITY = new StreamPriority() {\n    @Override\n    public StreamPriority setWeight(short weight) {\n      throw new UnsupportedOperationException(\"Unmodifiable stream priority\");\n    }\n\n    @Override\n    public StreamPriority setDependency(int dependency) {\n      throw new UnsupportedOperationException(\"Unmodifiable stream priority\");\n    }\n\n    @Override\n    public StreamPriority setExclusive(boolean exclusive) {\n      throw new UnsupportedOperationException(\"Unmodifiable stream priority\");\n    }\n  };\n\n\n  private HttpUtils() {\n  }\n\n  /**","sourceCodeStart":177,"sourceCodeEnd":213,"githubUrl":"https://github.com/eclipse-vertx/vert.x/blob/fb308bd8c3f12c79f4ae89bef67fadf6c80d036e/vertx-core/src/main/java/io/vertx/core/http/impl/HttpUtils.java#L177-L213","documentation":"HttpUtils.DEFAULT_STREAM_PRIORITY is an immutable StreamPriority sentinel shared by Vert.x for streams with no explicit priority. Its setters throw UnsupportedOperationException to prevent mutating the shared instance. Calling setWeight on this sentinel means code is attempting to modify an object it does not own.","triggerScenarios":"Calling setWeight(short) on StreamPriority.DEFAULT_STREAM_PRIORITY, or on a StreamPriority instance obtained from a stream/response that is backed by this unmodifiable default.","commonSituations":"Retrieving the default priority via a stream's priority() accessor and trying to tune it (e.g. changing HTTP/2 weight) without creating a new StreamPriority object first.","solutions":["Create a new StreamPriority, call setWeight on it, then apply it via stream.updatePriority(...)","Never mutate a StreamPriority obtained from an API; treat all returned priorities as read-only copies","If a custom default is needed, build a dedicated instance per use site instead of reusing DEFAULT_STREAM_PRIORITY"],"exampleFix":"// before\nStreamPriority p = stream.priority();\np.setWeight((short) 32);\n// after\nStreamPriority p = new StreamPriority().setWeight((short) 32).setDependency(0);\nstream.updatePriority(p);","handlingStrategy":"validation","validationCode":"if (priority == StreamPriority.DEFAULT_STREAM_PRIORITY) {\n  priority = new StreamPriority();\n}\npriority.setWeight(weight);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always construct a new StreamPriority before changing weight/dependency/exclusive","Treat StreamPriority returned by APIs as immutable","Apply changes via stream.updatePriority(newPriority)"],"tags":["http2","immutability","stream-priority"],"backgroundTag":"unsupported-operation","analyzedSha":"fb308bd8c3f12c79f4ae89bef67fadf6c80d036e","analyzedAt":"2026-09-06T11:37:12.241Z","contentChangedAt":"2026-09-06T11:37:12.241Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}