# Stan Runtime Error Line Number

**URL:** <https://discourse.mc-stan.org/t/stan-runtime-error-line-number/19275>\
**Category:** RStan\
**Created:** [November 14, 2020, 1:54pm UTC](https://discourse.mc-stan.org/t/stan-runtime-error-line-number/19275 "2020-11-14T13:54:15Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Thomas](https://avatars.discourse-cdn.com/v4/letter/t/e36b37/32.png) [@Thomas](https://discourse.mc-stan.org/u/Thomas)\
**Post date:** [November 14, 2020, 1:54pm UTC](https://discourse.mc-stan.org/t/stan-runtime-error-line-number/19275/1 "2020-11-14T13:54:15Z")

</div>

Simple question, but I can’t seem to find an answer on my own. I get a runtime error like this:

Chain 1: Exception: assign: Rows of left-hand-side (25) and rows of right-hand-side (19) must match in size (in ‘model22b17ee56514\_892f6d2e227201e78655369fc13998ab’ at line 98)

How do I identify line 98 in my Stan code, which is defined as a character string in the R code?

version R version 4.0.3 (2020-10-10)  
os Linux Mint 20  
system x86\_64, linux-gnu  
ui RStudio  
language en\_US  
RStan Version 2.21.2

---

<div class="post-metadata">

**Author:** ![bgoodri](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/bgoodri/32/4451_2.png) [@bgoodri](https://discourse.mc-stan.org/u/bgoodri)\
**Post date:** [November 14, 2020, 4:28pm UTC](https://discourse.mc-stan.org/t/stan-runtime-error-line-number/19275/2 "2020-11-14T16:28:30Z")

</div>

> [@Thomas](#):
>
> How do I identify line 98 in my Stan code, which is defined as a character string in the R code?

Count from the top. Or save the Stan code as an external file so that you can open it in virtually any editor that either shows the line numbers or can jump to a specified line.

---

<div class="post-metadata">

**Author:** ![vgdeven](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/vgdeven/32/18086_2.png) [@vgdeven](https://discourse.mc-stan.org/u/vgdeven)\
**Post date:** [March 20, 2024, 6:42pm UTC](https://discourse.mc-stan.org/t/stan-runtime-error-line-number/19275/3 "2024-03-20T18:42:48Z")

</div>

@bgoodri

I am relatively new to using Stan and thus am figuring things out. I program my models in a .stan file. I have noticed that the line numbers suggested in the error message do not match with the ones that I have in my file. I have also noticed that the line numbers match if I remove the comments entirely. So I am guessing stan or my compiler has some hidden code or setting that is disregarding the commented sections of the code.

My questions –

1. Is there a way to make the compiler consider comments in the stan file as place holder to as to report the lines with better accuracy?

2. Is there a way to generate a more verbose error message so as to generate some contextual definition of the location of the error just in case number 1 is not possible?

Any help will be appreciated.

Thank you in advance.
