# Error while accessing a headless leaf bundle in multilingual mode

**URL:** <https://discourse.gohugo.io/t/error-while-accessing-a-headless-leaf-bundle-in-multilingual-mode/17350>\
**Category:** support\
**Created:** [March 3, 2019, 2:37am UTC](https://discourse.gohugo.io/t/error-while-accessing-a-headless-leaf-bundle-in-multilingual-mode/17350 "2019-03-03T02:37:52Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![butaca](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/butaca/32/5159_2.png) [@butaca](https://discourse.gohugo.io/u/butaca)\
**Post date:** [March 3, 2019, 2:37am UTC](https://discourse.gohugo.io/t/error-while-accessing-a-headless-leaf-bundle-in-multilingual-mode/17350/1 "2019-03-03T02:37:52Z")

</div>

I’m getting the following error:

`execute of template failed: panic in Execute: runtime error: invalid memory address or nil pointer dereference. See "https://github.com/gohugoio/hugo/issues/5327" for the reason why we cannot provide a better error message for this.`

I isolated the issue in a minimal project, adding the following files to an empty project:

content/bundle/index.md

```
---
headless: true
title: Bundle Title
---

```

layouts/index.html

```
{{- $bundle := .Site.GetPage "/bundle" -}}
{{- $bundle.Title -}}

```

config.toml

```
[languages]
  [languages.en]
  [languages.es]

```

If you empty the config.toml or replace index.md with index.es.md and index.en.md the error goes away.

Any thoughts on this?

---

<div class="post-metadata">

**Author:** ![regis](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/regis/32/4958_2.png) [@regis](https://discourse.gohugo.io/u/regis)\
**Post date:** [March 3, 2019, 8:21pm UTC](https://discourse.gohugo.io/t/error-while-accessing-a-headless-leaf-bundle-in-multilingual-mode/17350/2 "2019-03-03T20:21:33Z")

</div>

Hey there,

do you have a repo for this minimal project?

---

<div class="post-metadata">

**Author:** ![butaca](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/butaca/32/5159_2.png) [@butaca](https://discourse.gohugo.io/u/butaca)\
**Post date:** [March 3, 2019, 8:51pm UTC](https://discourse.gohugo.io/t/error-while-accessing-a-headless-leaf-bundle-in-multilingual-mode/17350/3 "2019-03-03T20:51:14Z")

</div>

I don’t. I thought creating a repo for this is overkill. You can create the project with this script:

```
hugo new site hugo-bundle-multilingual
cd hugo-bundle-multilingual
mkdir ./content/bundle
cat <<'EOF' >./content/bundle/index.md
---
headless: true
title: Bundle Title
---
EOF

cat <<'EOF' >./layouts/index.html
{{- $bundle := .Site.GetPage "/bundle" -}}
{{- $bundle.Title -}}
EOF

cat <<'EOF' >./config.toml
[languages]
  [languages.en]
  [languages.es]
EOF
```

---

<div class="post-metadata">

**Author:** ![zwbetz](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/zwbetz/32/16088_2.png) [@zwbetz](https://discourse.gohugo.io/u/zwbetz)\
**Post date:** [March 3, 2019, 8:58pm UTC](https://discourse.gohugo.io/t/error-while-accessing-a-headless-leaf-bundle-in-multilingual-mode/17350/4 "2019-03-03T20:58:40Z")

</div>

Unrelated to the original topic, but I had to google what the heck `cat <<'EOF'` was doing. Very cool. TIL you can append multi-line strings to files like that 🙂

---

<div class="post-metadata">

**Author:** ![bep](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/bep/32/3332_2.png) [@bep](https://discourse.gohugo.io/u/bep)\
**Post date:** [March 3, 2019, 9:07pm UTC](https://discourse.gohugo.io/t/error-while-accessing-a-headless-leaf-bundle-in-multilingual-mode/17350/5 "2019-03-03T21:07:12Z")

</div>

> [@butaca](#):
>
> {{- $bundle := .Site.GetPage “/bundle” -}} {{- $bundle.Title -}}

Since your bundle is only available in one of the sites, you need to do something ala:

```auto
{{ $bundle := .Site.GetPage "/bundle" }}
{{ with $bundle }}
{{ .Title }}
{{ end}}

```

Also note that you will get a better error message for this particular situation in the next Hugo.

---

<div class="post-metadata">

**Author:** ![butaca](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/butaca/32/5159_2.png) [@butaca](https://discourse.gohugo.io/u/butaca)\
**Post date:** [March 3, 2019, 9:58pm UTC](https://discourse.gohugo.io/t/error-while-accessing-a-headless-leaf-bundle-in-multilingual-mode/17350/6 "2019-03-03T21:58:23Z")

</div>

> [@bep](#):
>
> Since your bundle is only available in one of the sites

I thought that all languages defaulted to this file. Is there way to achieve this? I have some images that are the same for every language and the index.md file exists to indicate that the folder is a headless bundle, not a content file per se, so it’s the same file for every language.

---

<div class="post-metadata">

**Author:** ![bep](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/bep/32/3332_2.png) [@bep](https://discourse.gohugo.io/u/bep)\
**Post date:** [March 3, 2019, 11:26pm UTC](https://discourse.gohugo.io/t/error-while-accessing-a-headless-leaf-bundle-in-multilingual-mode/17350/7 "2019-03-03T23:26:52Z")

</div>

> [@On another topic](https://discourse.gohugo.io/t/1350/6):
>
> I thought that all languages defaulted to this file. Is there way to achieve this?

You need to duplicate the “index.md” file for every language; but the other languages will inherit the resources if not present
