# Q2cli: ZSH\_VERSION unbound variable error

**URL:** <https://forum.qiime2.org/t/q2cli-zsh-version-unbound-variable-error/7516>\
**Category:** Technical Support\
**Tags:** conda, q2cli\
**Created:** [December 18, 2018, 6:44pm UTC](https://forum.qiime2.org/t/q2cli-zsh-version-unbound-variable-error/7516 "2018-12-18T18:44:20Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jairideout](https://forum.qiime2.org/user_avatar/forum.qiime2.org/jairideout/32/9_2.png) [@jairideout](https://forum.qiime2.org/u/jairideout)\
**Post date:** [December 18, 2018, 6:44pm UTC](https://forum.qiime2.org/t/q2cli-zsh-version-unbound-variable-error/7516/1 "2018-12-18T18:44:20Z")

</div>

When activating a qiime2 2018.11 conda environment from within a bash script that has the `-u` option activated, q2cli's tab completion hook raises the following error message:

```shell
$HOME/miniconda3/envs/qiime2-2018.11/etc/conda/activate.d/50_activate_q2cli_tab_completion.sh: line 1: ZSH_VERSION: unbound variable

```

Note: the bash `-u` option ("nounset") raises an error when an undefined variable is attempted to be used.

Here's a minimal script to reproduce the error (tested on macOS):

```bash
#!/usr/bin/env bash
set -u

source activate qiime2-2018.11

```

The error message doesn't occur if `-u` is turned off before activating the conda environment:

```bash
#!/usr/bin/env bash
set -u

set +u
source activate qiime2-2018.11
set -u

```

It's probably a simple fix to how `ZSH_VERSION` is referenced in `50_activate_q2cli_tab_completion.sh`. Just wanted to note the issue and a workaround in case anyone else runs into it. Thanks!

---

<div class="post-metadata">

**Author:** ![Nicholas\_Bokulich](https://forum.qiime2.org/user_avatar/forum.qiime2.org/nicholas_bokulich/32/19937_2.png) [@Nicholas\_Bokulich](https://forum.qiime2.org/u/Nicholas_Bokulich)\
**Post date:** [December 31, 2018, 11:21pm UTC](https://forum.qiime2.org/t/q2cli-zsh-version-unbound-variable-error/7516/2 "2018-12-31T23:21:37Z")

</div>



---

<div class="post-metadata">

**Author:** ![thermokarst](https://forum.qiime2.org/letter_avatar_proxy/v4/letter/t/8e7dd6/32.png) [@thermokarst](https://forum.qiime2.org/u/thermokarst)\
**Post date:** [January 2, 2019, 6:55pm UTC](https://forum.qiime2.org/t/q2cli-zsh-version-unbound-variable-error/7516/3 "2019-01-02T18:55:50Z")

</div>

Thanks @jairideout, good find! I [opened an issue](https://github.com/qiime2/q2cli/issues/200) here --- I think this should be able to catch the 2019.1 release train - stay tuned!  
Thanks!

🦖 :qiime2:

---

<div class="post-metadata">

**Author:** ![thermokarst](https://forum.qiime2.org/letter_avatar_proxy/v4/letter/t/8e7dd6/32.png) [@thermokarst](https://forum.qiime2.org/u/thermokarst)\
**Post date:** [January 2, 2019, 6:55pm UTC](https://forum.qiime2.org/t/q2cli-zsh-version-unbound-variable-error/7516/4 "2019-01-02T18:55:55Z")

</div>


