It errors on exiting out for first time, from the next time on it works without any errors
My config
nnoremap <silent><leader>s :ScratchPreview<cr>
let g:scratch_height = 20
let g:scratch_top = 1
let g:scratch_persistence_file = '/tmp/scratch.vim'
let g:scratch_autohide = &hidden
let g:scratch_filetype = 'markdown'
It errors on exiting out for first time, from the next time on it works without any errors
My config