# TaskContainer replace throws documentation

**URL:** <https://discuss.gradle.org/t/taskcontainer-replace-throws-documentation/19921>\
**Category:** Bugs\
**Created:** [October 7, 2016, 10:04pm UTC](https://discuss.gradle.org/t/taskcontainer-replace-throws-documentation/19921 "2016-10-07T22:04:58Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![joebowbeer](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/joebowbeer/32/5640_2.png) [@joebowbeer](https://discuss.gradle.org/u/joebowbeer)\
**Post date:** [October 7, 2016, 10:04pm UTC](https://discuss.gradle.org/t/taskcontainer-replace-throws-documentation/19921/1 "2016-10-07T22:04:58Z")

</div>

Documentation for the two `replace` methods erroneously indicates that an exception is thrown if the task already exists:

[https://docs.gradle.org/current/javadoc/org/gradle/api/tasks/TaskContainer.html](https://docs.gradle.org/current/javadoc/org/gradle/api/tasks/TaskContainer.html)

```gradle
Throws:
    InvalidUserDataException - If a task with the given name already exists in this project.

```

Also, please clarify in the documentation if an exception is thrown when the task does **not** already exist.

Gradle Version: 3.1  
Operating System and JVM version: N/A  
Is this a regression? no
