# Problem after executing hugo --cleanDestinationDir

**URL:** <https://discourse.gohugo.io/t/problem-after-executing-hugo-cleandestinationdir/10980>\
**Category:** support\
**Created:** [March 11, 2018, 1:06am UTC](https://discourse.gohugo.io/t/problem-after-executing-hugo-cleandestinationdir/10980 "2018-03-11T01:06:19Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![JayanthRR](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/jayanthrr/32/8951_2.png) [@JayanthRR](https://discourse.gohugo.io/u/JayanthRR)\
**Post date:** [March 11, 2018, 1:06am UTC](https://discourse.gohugo.io/t/problem-after-executing-hugo-cleandestinationdir/10980/1 "2018-03-11T01:06:20Z")

</div>

I faced an issue after I ran the following command while deploying.  
`hugo --cleanDestinationDir`.  
Before this, I just used to run `hugo` to build and deploy and it was all working fine.

After I ran this, I got an error message saying git crashed. So I deleted .git/index.lock file and ran `hugo` command again. The following is the error message.

`Building sites … ERROR 2018/03/10 19:23:48 Unable to locate template for shortcode "staticref" in page "home/about.md"`

I tried to uninstall hugo and install again, and now I ran into a new problem.

I face the following problems.

- `Error: While parsing config: Near line 58 (last key parsed 'params.organizations'): Expected value but found '{' instead.` Config.toml at line 58 reads the following  
`organizations = [{ name = " ", url = " "}]`
- I commented out line 58, and executed `hugo` again. Now, I get around 20 errors saying the following  
`ERROR: 2018/03/10 19:56:50 page.go:833: Near line 6 (last key parsed 'date'): Expected 'T' in ISO8601 datetime, but found '\n' instead.`

I would be glad if someone can help me regarding this. Thanks in advance.

---

<div class="post-metadata">

**Author:** ![brunoamaral](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/brunoamaral/32/21144_2.png) [@brunoamaral](https://discourse.gohugo.io/u/brunoamaral)\
**Post date:** [March 11, 2018, 1:24pm UTC](https://discourse.gohugo.io/t/problem-after-executing-hugo-cleandestinationdir/10980/2 "2018-03-11T13:24:43Z")

</div>

Can you share the source?

Are those template files still present ?

What was your destinationDir?

---

<div class="post-metadata">

**Author:** ![neutreno](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/neutreno/32/1615_2.png) [@neutreno](https://discourse.gohugo.io/u/neutreno)\
**Post date:** [March 11, 2018, 8:18pm UTC](https://discourse.gohugo.io/t/problem-after-executing-hugo-cleandestinationdir/10980/3 "2018-03-11T20:18:28Z")

</div>

@bep do you know if the `--cleanDestinationDir` argument conflicts with the destination dir being a Git repo or git sub-module directory (e.g. in the case where `public/` is a git repo or git sub-module for GitHub Pages)? It sounds like there may possibly be a bug with it removing the `.git` sub-module folder in the above case…

---

<div class="post-metadata">

**Author:** ![JayanthRR](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/jayanthrr/32/8951_2.png) [@JayanthRR](https://discourse.gohugo.io/u/JayanthRR)\
**Post date:** [March 12, 2018, 6:09am UTC](https://discourse.gohugo.io/t/problem-after-executing-hugo-cleandestinationdir/10980/4 "2018-03-12T06:09:59Z")

</div>

I am extremely sorry, I am completely new to Hugo. What do you mean by source, and where to find those template files?  
I guess destination dir is public/ which was created as a git submodule.

---

<div class="post-metadata">

**Author:** ![brunoamaral](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/brunoamaral/32/21144_2.png) [@brunoamaral](https://discourse.gohugo.io/u/brunoamaral)\
**Post date:** [March 12, 2018, 10:44am UTC](https://discourse.gohugo.io/t/problem-after-executing-hugo-cleandestinationdir/10980/5 "2018-03-12T10:44:11Z")

</div>

Sorry @JayanthRR I should have been more clear.

Source refers to the files you used to produce the site. The only way I see this happening so far, is if your source was also in the public/ directory.

---

<div class="post-metadata">

**Author:** ![kaushalmodi](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/kaushalmodi/32/2567_2.png) [@kaushalmodi](https://discourse.gohugo.io/u/kaushalmodi)\
**Post date:** [March 12, 2018, 11:01am UTC](https://discourse.gohugo.io/t/problem-after-executing-hugo-cleandestinationdir/10980/6 "2018-03-12T11:01:18Z")

</div>

Based on the posted errors, your site source send to have multiple issues:

- You seen to have JSON-like curly braces in a TOML list in the config.toml.
- One or more of your content pages has the date front-matter in invalid format.

As @brunoamaral said, you’ll need to share the complete source of your site (that includes the config.toml, content dir, layouts dir, themes for, etc, except the public dir), if you cannot debug and fix these issues.

---

<div class="post-metadata">

**Author:** ![JayanthRR](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/jayanthrr/32/8951_2.png) [@JayanthRR](https://discourse.gohugo.io/u/JayanthRR)\
**Post date:** [March 16, 2018, 2:40am UTC](https://discourse.gohugo.io/t/problem-after-executing-hugo-cleandestinationdir/10980/7 "2018-03-16T02:40:00Z")

</div>

@kaushalmodi @brunoamaral  
I was away so I couldn’t reply earlier than this. I tried fixing some of those datetime errors, but there are way too many of those.  
How do I share the entire folders (content, themes, etc) here? The upload option here only accepts images. Do you want me to zip it?

---

<div class="post-metadata">

**Author:** ![kaushalmodi](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/kaushalmodi/32/2567_2.png) [@kaushalmodi](https://discourse.gohugo.io/u/kaushalmodi)\
**Post date:** [March 16, 2018, 2:48am UTC](https://discourse.gohugo.io/t/problem-after-executing-hugo-cleandestinationdir/10980/8 "2018-03-16T02:48:19Z")

</div>

The most common way is to use git. _If you haven’t yet used it, it’s an important life skill to learn 🙂._ Then commit and push to somewhere like GitHub or Gitlab.

---

<div class="post-metadata">

**Author:** ![JayanthRR](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/jayanthrr/32/8951_2.png) [@JayanthRR](https://discourse.gohugo.io/u/JayanthRR)\
**Post date:** [March 16, 2018, 3:07am UTC](https://discourse.gohugo.io/t/problem-after-executing-hugo-cleandestinationdir/10980/9 "2018-03-16T03:07:45Z")

</div>

Oh thanks. I was thinking if there is a way to share them here 🙂. This is the link to my repository.

> **[JayanthRR/jayanthrr.github.io](https://github.com/JayanthRR/jayanthrr.github.io)**
>
> Easily create a beautiful website using Academic and Hugo - JayanthRR/jayanthrr.github.io

---

<div class="post-metadata">

**Author:** ![brunoamaral](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/brunoamaral/32/21144_2.png) [@brunoamaral](https://discourse.gohugo.io/u/brunoamaral)\
**Post date:** [March 17, 2018, 4:32pm UTC](https://discourse.gohugo.io/t/problem-after-executing-hugo-cleandestinationdir/10980/10 "2018-03-17T16:32:31Z")

</div>

I took a quick look just now. From what I saw, instead of building the site in public/ it was built into the directory where the theme, config, and other source files where. That together with the cleanDestinationDir argument, deletes everything.

I would suggest reverting to a previous commit and try running `hugo -d public_html/` and see how it goes.

---

<div class="post-metadata">

**Author:** ![htr3n](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/htr3n/32/6368_2.png) [@htr3n](https://discourse.gohugo.io/u/htr3n)\
**Post date:** [April 1, 2018, 10:29am UTC](https://discourse.gohugo.io/t/problem-after-executing-hugo-cleandestinationdir/10980/11 "2018-04-01T10:29:56Z")

</div>

I spotted the same issue as the OP. I posted a issue reported [here](https://github.com/gohugoio/hugo/issues/4546) but bep thought it is not an issue but a discussion. When I found this thread, I also want to follow the issue being discussed here.

---

<div class="post-metadata">

**Author:** ![htr3n](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/htr3n/32/6368_2.png) [@htr3n](https://discourse.gohugo.io/u/htr3n)\
**Post date:** [April 5, 2018, 9:42pm UTC](https://discourse.gohugo.io/t/problem-after-executing-hugo-cleandestinationdir/10980/12 "2018-04-05T21:42:44Z")

</div>

Just to investigate and confirm on the related issues, I tried the newest DEV release and it seems to work properly, i.e., with option `--cleanDestinationDir`, the `.xxx` folders remain intact.

```auto
hugo version
Hugo Static Site Generator v0.39-DEV-4F639D6B darwin/amd64 BuildDate: 2018-04-03T21:52:29+1000

```
