# Error if channel is NOT empty

**URL:** <https://community.seqera.io/t/error-if-channel-is-not-empty/1592>\
**Category:** Ask for help\
**Tags:** nextflow\
**Created:** [January 7, 2025, 8:35pm UTC](https://community.seqera.io/t/error-if-channel-is-not-empty/1592 "2025-01-07T20:35:02Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![mahesh.binzerpanchal](https://dub1.discourse-cdn.com/flex013/user_avatar/community.seqera.io/mahesh.binzerpanchal/32/253_2.png) [@mahesh.binzerpanchal](https://community.seqera.io/u/mahesh.binzerpanchal)\
**Post date:** [January 13, 2025, 1:43pm UTC](https://community.seqera.io/t/error-if-channel-is-not-empty/1592/3 "2025-01-13T13:43:08Z")

</div>

If a channel is empty, the following operator won’t do anything so simply add a `map` on the end of your channel.

```groovy
params.input = false
workflow {
    ch_in = params.input ? Channel.fromList([1, 2, 3]) : Channel.empty()
    ch_in.map{ error "Error: Channel is not empty" }
}

```

---

_[View the full topic](https://community.seqera.io/t/error-if-channel-is-not-empty/1592)._
