# Enhancing "drone starlark convert" runtime check

**URL:** <https://drone.discourse.group/t/enhancing-drone-starlark-convert-runtime-check/10327>\
**Category:** Drone Support\
**Created:** [April 14, 2020, 8:35pm UTC](https://drone.discourse.group/t/enhancing-drone-starlark-convert-runtime-check/10327 "2020-04-14T20:35:19Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![junaruga](https://yyz1.discourse-cdn.com/flex003/user_avatar/drone.discourse.group/junaruga/32/5849_2.png) [@junaruga](https://drone.discourse.group/u/junaruga)\
**Post date:** [April 14, 2020, 8:35pm UTC](https://drone.discourse.group/t/enhancing-drone-starlark-convert-runtime-check/10327/1 "2020-04-14T20:35:20Z")

</div>

Hello Drone community.  
I would like to discuss about the possibility to enhance `drone starlark convert`’s runtime error check.

For example the following runtime happens with [this .drone.star file](https://github.com/junaruga/simde/blob/report/drone-cli-starlark-check/.drone.star).

```auto
$ drone starlark convert --stdout
2020/04/14 22:20:45 yaml: unmarshal errors:
  line 1: cannot unmarshal !!seq into string

```

This error is created intentionally by [the latest one commit](https://github.com/junaruga/simde/commit/10af6f0fea3f4ed33aa4c1235a187c1b2ef606e4) on my forked repository’s branch of simde project.  
And this error is what I actually faced, when I was working on the `.drone.star` file in the project.

How do you think adding the line number of the `.drone.star` file causing the error? It helps the debugging.

Or what is the best practice to debug in this case?

---

<div class="post-metadata">

**Author:** ![bradrydzewski](https://yyz1.discourse-cdn.com/flex003/user_avatar/drone.discourse.group/bradrydzewski/32/3513_2.png) [@bradrydzewski](https://drone.discourse.group/u/bradrydzewski)\
**Post date:** [April 15, 2020, 3:41am UTC](https://drone.discourse.group/t/enhancing-drone-starlark-convert-runtime-check/10327/2 "2020-04-15T03:41:53Z")

</div>

The last document has an invalid commands section. The commands section should be an array of strings, however, one of the items in the array is an array.

```diff
{
  "platform": {
    "os": "linux", 
    "arch": "arm64"
  }, 
  "kind": "pipeline", 
  "type": "docker", 
  "name": "fedora clang arm64 flags", 
  "steps": [
    {
      "environment": {
        "CC": "clang", 
        "CXX": "clang++"
      }, 
      "failure": "ignore", 
      "commands": [
        "uname -m", 
        "cat /proc/cpuinfo", 
        "dnf install -y clang ninja-build git-core python3-pip", 
        "pip3 install meson", 
        "git submodule --quiet update --init --recursive", 
- [
- "ARCH_FLAGS=$(rpm -E '%{optflags}' | sed -e 's| -fstack-clash-protection||' -e 's| -specs=[^]*||g')", 
- "mkdir -p build", 
- "cd build", 
- "CFLAGS=\"$ARCH_FLAGS\" CXXFLAGS=\"$ARCH_FLAGS\" meson ..", 
- "ninja -v", 
- "./test/run-tests"
- ]
      ], 
      "image": "fedora:rawhide", 
      "name": "test"
    }
  ]
}

```

I was able to debug by running this command which prints the raw results without formatting or linting:

```nohighlight
drone starlark --stdout --format=false

```

---

<div class="post-metadata">

**Author:** ![junaruga](https://yyz1.discourse-cdn.com/flex003/user_avatar/drone.discourse.group/junaruga/32/5849_2.png) [@junaruga](https://drone.discourse.group/u/junaruga)\
**Post date:** [April 15, 2020, 8:48am UTC](https://drone.discourse.group/t/enhancing-drone-starlark-convert-runtime-check/10327/3 "2020-04-15T08:48:23Z")

</div>

Great! Thank you for debugging, and share the useful way `drone starlark --stdout --format=false`.

> This error is created intentionally by the latest one commit on my forked repository’s branch of simde project.

As I said above, this error was created to report here. I knew the cause of the error before reporting it here.

On the timeline,

1. I faced the error
2. I fixed the error
3. I reported to discuss the topic here reproducing the error.

So what do you think about improving the `drone starlark convert` command to show the error message with the actual `.drone.star` line number ( **N** ) and the element that causes the runtime error (**yaml [item number] [“steps”][0][“commands”][5]**) like this?

```auto
$ drone starlark convert --stdout
2020/04/14 22:20:45 yaml: unmarshal errors:
  line N: cannot unmarshal !!seq into string at yaml [item number] ["steps"][0]["commands"][5].

```

---

<div class="post-metadata">

**Author:** ![bradrydzewski](https://yyz1.discourse-cdn.com/flex003/user_avatar/drone.discourse.group/bradrydzewski/32/3513_2.png) [@bradrydzewski](https://drone.discourse.group/u/bradrydzewski)\
**Post date:** [April 15, 2020, 3:33pm UTC](https://drone.discourse.group/t/enhancing-drone-starlark-convert-runtime-check/10327/4 "2020-04-15T15:33:30Z")

</div>

> [@On another topic](https://drone.discourse.group/t/7139/3):
>
> So what do you think about improving the `drone starlark convert` command to show the error message with the actual `.drone.star` line number ( **N** ) and the element that causes the runtime error ( **yaml [item number] [“steps”][0][“commands”][5]** ) like this?

I do not think this is possible because we have no way to associate a line in the yaml with the corresponding line in the starlark program that caused the problem.

---

<div class="post-metadata">

**Author:** ![junaruga](https://yyz1.discourse-cdn.com/flex003/user_avatar/drone.discourse.group/junaruga/32/5849_2.png) [@junaruga](https://drone.discourse.group/u/junaruga)\
**Post date:** [April 20, 2020, 1:09pm UTC](https://drone.discourse.group/t/enhancing-drone-starlark-convert-runtime-check/10327/5 "2020-04-20T13:09:50Z")

</div>

Sure. Thanks for the answer.
