# Command '' was not defined in any pipeline files, refusing to run

**URL:** <https://forum.buildkite.community/t/command-was-not-defined-in-any-pipeline-files-refusing-to-run/2184>\
**Category:** Pipelines\
**Created:** [August 22, 2022, 6:42pm UTC](https://forum.buildkite.community/t/command-was-not-defined-in-any-pipeline-files-refusing-to-run/2184 "2022-08-22T18:42:03Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![js-cb](https://avatars.discourse-cdn.com/v4/letter/j/8797f3/32.png) [@js-cb](https://forum.buildkite.community/u/js-cb)\
**Post date:** [August 22, 2022, 6:42pm UTC](https://forum.buildkite.community/t/command-was-not-defined-in-any-pipeline-files-refusing-to-run/2184/1 "2022-08-22T18:42:03Z")

</div>

I’m trying the most simple pipeline of all times and yet I get the above error. Here I’m trying to determine if the `env` elements apply to my `command` or not?

```auto
steps:
  - label: 'env test'
    agents: 
      queue: docker
    env:
      MYVAR: some-value
    command:
      - echo "MYVAR = $MYVAR"

  - wait

```

pipeline terminates with:

```auto
2022-08-22 18:34:39 INFO Updating BUILDKITE_COMMIT to "982cd7ee979b40238d3b7f43ff9cb4981b164365"
Command '' was not defined in any pipeline files, refusing to run
Error: The global pre-command hook exited with status 1

```

---

<div class="post-metadata">

**Author:** ![iammcgaber](https://avatars.discourse-cdn.com/v4/letter/i/f6c823/32.png) [@iammcgaber](https://forum.buildkite.community/u/iammcgaber)\
**Post date:** [August 22, 2022, 6:53pm UTC](https://forum.buildkite.community/t/command-was-not-defined-in-any-pipeline-files-refusing-to-run/2184/2 "2022-08-22T18:53:01Z")

</div>

This is just a mistake between the plural `commands` which takes a map vs the singular `command` which takes a single argument. See the distinction in the docs: [Command Step | Buildkite Documentation](https://buildkite.com/docs/pipelines/command-step).

So just change it to plural:

```auto
    commands:
      - echo "MYVAR = $MYVAR"

```

or make it one-line:

```auto
command: echo "MYVAR = $MYVAR"

```

---

<div class="post-metadata">

**Author:** ![js-cb](https://avatars.discourse-cdn.com/v4/letter/j/8797f3/32.png) [@js-cb](https://forum.buildkite.community/u/js-cb)\
**Post date:** [August 22, 2022, 8:24pm UTC](https://forum.buildkite.community/t/command-was-not-defined-in-any-pipeline-files-refusing-to-run/2184/3 "2022-08-22T20:24:24Z")

</div>

Thanks. Did not know about that difference  
I changed it to this based on the document you linked to:

```auto
steps:
  - label: 'env test'
    commands:
      - "echo MYVAR = $MYVAR"
      - "ls"
    env:
      MYVAR: "some-value"

  - wait

```

The error message is still the same:

`Command '' was not defined in any pipeline files, refusing to run`

---

<div class="post-metadata">

**Author:** ![js-cb](https://avatars.discourse-cdn.com/v4/letter/j/8797f3/32.png) [@js-cb](https://forum.buildkite.community/u/js-cb)\
**Post date:** [August 22, 2022, 8:28pm UTC](https://forum.buildkite.community/t/command-was-not-defined-in-any-pipeline-files-refusing-to-run/2184/4 "2022-08-22T20:28:38Z")

</div>

I cannot possibly make this test any simpler and it still fails!!!

```auto
steps:
  - label: 'env test'
    command: echo hello
    env:
      MYVAR: "some-value"

  - wait

```

---

<div class="post-metadata">

**Author:** ![js-cb](https://avatars.discourse-cdn.com/v4/letter/j/8797f3/32.png) [@js-cb](https://forum.buildkite.community/u/js-cb)\
**Post date:** [August 22, 2022, 8:34pm UTC](https://forum.buildkite.community/t/command-was-not-defined-in-any-pipeline-files-refusing-to-run/2184/5 "2022-08-22T20:34:43Z")

</div>

Or even this fails:

```auto
steps:
  - command: echo hello

  - wait

```

```auto
Command '' was not defined in any pipeline files, refusing to run
🚨 Error: The global pre-command hook exited with status 1

```

---

<div class="post-metadata">

**Author:** ![js-cb](https://avatars.discourse-cdn.com/v4/letter/j/8797f3/32.png) [@js-cb](https://forum.buildkite.community/u/js-cb)\
**Post date:** [August 22, 2022, 9:32pm UTC](https://forum.buildkite.community/t/command-was-not-defined-in-any-pipeline-files-refusing-to-run/2184/6 "2022-08-22T21:32:50Z")

</div>

It looks like this is not a buildkite issue but rather a pre-hook that my company has setup. I’ll take this up with them. thanks
