Error: scss

The problem is that the project became too big and I cant even understand where the problem is, but Ill try.
Before every error in console output I was the receiving the last file that hugo was processing. I’ve finished moving scss files to assets and problems with scss disappeared, now I’m receiving errors with image files. Maybe you could give me advice about images processing?
I’m using this code below to process images and put in in picture tag. The name of a picture I get from .md file by passing variable to shortcode
{{ directory := index (index .Site.Data $.Site.Params.locale) (.Get “directory”) }}
{{ $filename := index $directory (.Get “filename”) }}

{{ $321x1__image_1 := .Scratch.Get "321x1_1" }}
{{ $321x2__image_1 := .Scratch.Get "321x2_1" }}
{{ $568x1__image_1 := .Scratch.Get "568x1_1" }}
{{ $568x2__image_1 := .Scratch.Get "568x2_1" }}
{{ $768x1__image_1 := .Scratch.Get "768x1_1" }}
{{ $768x2__image_1 := .Scratch.Get "768x2_1" }}
{{ $1024x1__image_1 := .Scratch.Get "1024x1_1" }}
{{ $1024x2__image_1 := .Scratch.Get "1024x2_1" }}
{{ $1440x1__image_1 := .Scratch.Get "1440x1_1" }}
{{ $1440x2__image_1 := .Scratch.Get "1440x2_1" }}

{{ $original_1 := .Page.Resources.GetMatch (printf "*%s*" ($filename.image)) }}
{{ .Scratch.Set "321x1_1" ($original_1.Resize "321x") }}
{{ .Scratch.Set "321x2_1" ($original_1.Resize "642x") }}

{{ .Scratch.Set "568x1_1" ($original_1.Resize "568x") }}
{{ .Scratch.Set "568x2_1" ($original_1.Resize "1136x") }}

{{ .Scratch.Set "768x1_1" ($original_1.Resize "768x") }}
{{ .Scratch.Set "768x2_1" ($original_1.Resize "1536x") }}

{{ .Scratch.Set "1024x1_1" ($original_1.Resize "1024x") }}
{{ .Scratch.Set "1024x2_1" ($original_1.Resize "2048x") }}

{{ .Scratch.Set "1440x1_1" ($original_1.Resize "1440x") }}
{{ .Scratch.Set "1440x2_1" ($original_1.Resize "2880x") }}

{{ .Scratch.Set "1439x1_1" ($original_1.Resize "1439x") }}
{{ .Scratch.Set "1439x2_1" ($original_1.Resize "2878x") }}


{{ $321x1__image_1 := .Scratch.Get "321x1_1" }}
{{ $321x2__image_1 := .Scratch.Get "321x2_1" }}
{{ $568x1__image_1 := .Scratch.Get "568x1_1" }}
{{ $568x2__image_1 := .Scratch.Get "568x2_1" }}
{{ $768x1__image_1 := .Scratch.Get "768x1_1" }}
{{ $768x2__image_1 := .Scratch.Get "768x2_1" }}
{{ $1024x1__image_1 := .Scratch.Get "1024x1_1" }}
{{ $1024x2__image_1 := .Scratch.Get "1024x2_1" }}
{{ $1440x1__image_1 := .Scratch.Get "1440x1_1" }}
{{ $1440x2__image_1 := .Scratch.Get "1440x2_1" }}

And I receive next error goroutine

1409 [running]:
github.com/gohugoio/hugo/hugolib.(*shortcodeHandler).executeShortcodesForDelta(0xc020246a20, 0xc0213cd868, 0x1b, 0xc007fc2600)
       /private/tmp/hugo-20181224-98242-12trytm/hugo-0.53/src/github.com/gohugoio/hugo/hugolib/shortcode.go:560 +0xc5

It’s very hard to pinpoint the problem with limited information.

Can you post the complete output from running the hugo / hugo server command?

It looks like the problem with images appeared because of IDEA caching, I just excluded resource directory and at least for now everything works…