# Location of cylc-run not set in workflow?

**URL:** <https://cylc.discourse.group/t/location-of-cylc-run-not-set-in-workflow/797>\
**Category:** Cylc Support\
**Created:** [November 1, 2023, 4:39am UTC](https://cylc.discourse.group/t/location-of-cylc-run-not-set-in-workflow/797 "2023-11-01T04:39:26Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![jonnyhtw](https://yyz2.discourse-cdn.com/free1/user_avatar/cylc.discourse.group/jonnyhtw/32/232_2.png) [@jonnyhtw](https://cylc.discourse.group/u/jonnyhtw)\
**Post date:** [November 1, 2023, 4:39am UTC](https://cylc.discourse.group/t/location-of-cylc-run-not-set-in-workflow/797/1 "2023-11-01T04:39:26Z")

</div>

hi there,

i’m working on a workflow with a colleague who is not getting this error so i am assuming it’s something that is somehow hard-wired to their $HOME?

the task in question is trying to write to `/cylc-run` rather than `$HOME/cylc-run` and is hence failing.

how could i test for how this is being set incorrectly in this task?

strangely it is working for other tasks of mine in the same workflow!

thanks for any ideas!

jonny

---

<div class="post-metadata">

**Author:** ![dpmatthews](https://yyz2.discourse-cdn.com/free1/user_avatar/cylc.discourse.group/dpmatthews/32/26_2.png) [@dpmatthews](https://cylc.discourse.group/u/dpmatthews)\
**Post date:** [November 1, 2023, 8:35am UTC](https://cylc.discourse.group/t/location-of-cylc-run-not-set-in-workflow/797/2 "2023-11-01T08:35:30Z")

</div>

It depends what you mean. Is the job producing output (i.e. is it managing to write to `job.out` / `job.err`)? If so the problem is happening within the job script. Try running the workflow with the `--debug` option - this will enable the bash `xtrace` option which should help you see what going on.

If the job isn’t producing any output then that probably implies a problem with the job submission. The job output files are specified as relative paths and assume the job is submitted from your `$HOME` directory. Make sure there is nothing in profile scripts which could change this (`bash -l` should put you in `$HOME`).

---

<div class="post-metadata">

**Author:** ![hilary.j.oliver](https://yyz2.discourse-cdn.com/free1/user_avatar/cylc.discourse.group/hilary.j.oliver/32/4_2.png) [@hilary.j.oliver](https://cylc.discourse.group/u/hilary.j.oliver)\
**Post date:** [November 1, 2023, 8:38pm UTC](https://cylc.discourse.group/t/location-of-cylc-run-not-set-in-workflow/797/3 "2023-11-01T20:38:20Z")

</div>

> [@jonnyhtw](#):
>
> the task in question is trying to write to `/cylc-run` rather than `$HOME/cylc-run`

@jonnyhtw - to expand a bit on what @dpmatthews said, do you mean:

- the user-defined code in that task is trying to write there?
- or Cylc is trying to write the job log files there?
- or Cylc is trying to create the run directory there during “job init”?

---

<div class="post-metadata">

**Author:** ![jonnyhtw](https://yyz2.discourse-cdn.com/free1/user_avatar/cylc.discourse.group/jonnyhtw/32/232_2.png) [@jonnyhtw](https://cylc.discourse.group/u/jonnyhtw)\
**Post date:** [November 6, 2023, 12:48am UTC](https://cylc.discourse.group/t/location-of-cylc-run-not-set-in-workflow/797/4 "2023-11-06T00:48:13Z")

</div>

thanks @dpmatthews @hilary.j.oliver!

this is the workflow graph for what’s going on. the error is in `set_unicicles`

 ![image](https://global.discourse-cdn.com/free1/uploads/cylc1/original/1X/092125e965876836bd7b28efb2d28239d9f57b9f.png)

this is the error message that i am getting in the `job.err`…

```auto
[FAIL] [Errno 13] Permission denied: '/cylc-run'
InputError: Workflow ID not found: u-da879/run5
(Directory not found: /cylc-run/u-da879/run5)

```

this works for a colleague who i am working on this workflow with so i am assuming that there is an environment variable set somewhere in their environment.

@dpmatthews i’ll try `cylc trigger` with the `--debug` option as you suggest. thanks!

jonny

---

<div class="post-metadata">

**Author:** ![hilary.j.oliver](https://yyz2.discourse-cdn.com/free1/user_avatar/cylc.discourse.group/hilary.j.oliver/32/4_2.png) [@hilary.j.oliver](https://cylc.discourse.group/u/hilary.j.oliver)\
**Post date:** [November 6, 2023, 1:11am UTC](https://cylc.discourse.group/t/location-of-cylc-run-not-set-in-workflow/797/5 "2023-11-06T01:11:26Z")

</div>

@jonnyhtw,

That’s coming from the running task job.

I’m guessing that somewhere in the task definition, or in a script that it runs, `$HOME` is being unset, or set to an undefined or empty variable.

I can’t imagine why, but the symptom kinda points in that direction!

---

<div class="post-metadata">

**Author:** ![jonnyhtw](https://yyz2.discourse-cdn.com/free1/user_avatar/cylc.discourse.group/jonnyhtw/32/232_2.png) [@jonnyhtw](https://cylc.discourse.group/u/jonnyhtw)\
**Post date:** [November 9, 2023, 4:08am UTC](https://cylc.discourse.group/t/location-of-cylc-run-not-set-in-workflow/797/6 "2023-11-09T04:08:04Z")

</div>

hi again,

just to update y’all, this is working now. this was the offending line in one of the ‘site’ optional config files, which is processed to make the `flow-processed.cylc` file…

```auto
init-script = "export HOME=$DATADIR"

```

i hadn’t come across init scripts before so i’ve learnt something!

cheers
