English
城には金銀が保管してあったはずだ。
I'm a native speaker of Japanese.
I examined the function of "が" in the given sentence, and I realized Japanese is really difficult.
I looked up the meaning of "が" in jisho.org, it is defined as follows, but none of them seems to correspond to the answer to the given question.
が
Particle
1 indicates sentence subject (occasionally object)
「あの音{おと}で考{かんが}え事{ごと}ができないわ」と彼女{かのじょ}はタイプライターを見{み}つめながら言{い}った。
"I can't think with that noise", she said as she stared at the typewriter.
2 indicates possessive (esp. in literary expressions)
The following description and examples of the possessive case are cited from other than jisho.org.
"が" is an old-fashioned usage and is equivalent to "の" today.
誰{た}がために鐘{かね}は鳴{な}る = 誰{だれ}のために鐘は鳴る。我{わ}が家{や} = 私{わたし}の家{いえ}
For whom the bell tolls. My house
Particle, Conjunction
3 but; however; still; and
言{い}うまでもないことだがローマは1日{にち}にしては成{な}らず。
It goes without saying that Rome was not built in a day.
As for the particle "が", there is an actual function other than the definitions written in jisho.org, as in an example of "(私は)リンゴが好きです I like apples".
They are explained here , here and here. The content of latter two articles is briefly described as follows:
In the case of "好き like", "嫌い dislike", "欲しい want" and "可能動詞 possible verbs", you can also use "が" such as the particle "を" to make the preceding noun an object, where "が" represents the state and "を" represents the will of action.
Even if I examine the new usage of "が", I cannot logically and/or grammatically explain "が" in the phrase given by the questioner.
So, I understand that a case particle "が" in the given phrase was incorrectly used by the writer, and I'll explain it below.
(0) 城には金銀が保管してあったはずだ。
In the given phrase (0), if you omit the redundant part for the explanation and change the tense to the present form, you will get (1)
(1) 城には金銀が保管してある。
I guess the writer wanted to say the following (2) and (3) at the same time.
(2) 城には金銀がある
(3) (彼ら/城主は)その金銀を保管している
As you know, a subject is mostly omitted, so the role of case particles is important in Japanese where a relative is not developed unlike English. The incorrect use of the case particle in the given phrase seems to be due to the neglect of grammatical consistency because of the fact that there were multiple things to tell and each of them had different wording from each other even if the writer knew that correct use of case particles are important.
However, I think that it is almost certainly possible to interpret the intention of the writer even with a phrase containing such a mistake, and expressions of this kind of mistakes are quite common every day.
In addition, there is also a research here on how the reader understands a sentence if a case particle is used incorrectly.
日本語
城には金銀が保管してあったはずだ。
上記の文は、一見どこもおかしくないようですが、「金銀」が主語?、「金銀を保管」の方が正しいのかな?と思うと、確かにどこか変な気もします。
日本語は難しいですね。
早速、jisho.orgで「が」の意味を調べると次のようになっていました。
が
Particle
1 indicates sentence subject (occasionally object)
「あの音{おと}で考{かんが}え事{ごと}ができないわ」と彼女{かのじょ}はタイプライターを見{み}つめながら言{い}った。
"I can't think with that noise", she said as she stared at the typewriter.
2 indicates possessive (esp. in literary expressions)
The following description and examples of the possessive case are cited from other than jisho.org.
"が" is an old-fashioned usage and is equivalent to "の" today.
誰{た}がために鐘{かね}は鳴{な}る = 誰{だれ}のために鐘は鳴る。我{わ}が家{や} = 私{わたし}の家{いえ}
For whom the bell tolls. My house
Particle, Conjunction
3 but; however; still; and
言{い}うまでもないことだがローマは1日{にち}にしては成{な}らず。
It goes without saying that Rome was not built in a day.
助詞「が」については、「(私は)リンゴが好{す}き」の例にあるように、jisho.org以外の機能が実際にあるようです。そして、ここやここやここにその説明があります。後の2つの文献にはほぼ同じ説明があり、その内容を簡単に言うと次のようになっております。
「好き」、「嫌い」、「欲しい」などや可能動詞の場合、目的語を表す助詞「を」のように「が」も使える。その場合、「が」は状態を表し、「を」は行為の意志を表す。
この説明によっても、質問者が提示したフレーズの「が」を論理的にあるいは文法的にきちんと説明できそうにありません。
そこで、私は、与えられたフレーズは書き手が格助詞の使い方を間違ったものとして理解し、以下に説明していこうと思います。
(0) 城には金銀が保管してあったはずだ。
(0)のフレーズから、「が」を説明する上で不要な部分を削除し、時制を現在形にすると(1)のようになります。
(1) 城には金銀が保管してある。
私は、作者が次の(2)、(3)のことを同時に言いたかったのだろうと思いました。
(2) 城には金銀がある
(3) (彼ら/城主は)その金銀を保管している
主語がほとんどの場合省略され、英語と違って関係詞が発達していない日本語において助詞の役目は大切です。しかし、この度の過ちは、助詞が大切であることは書き手がたとえ知っていても、伝えたいことが複数あり、しかも各々の言い回しに惑わされて文法的な整合性をおろそかにしたためだと思われます
しかし、このような過ちが入っているフレーズでも我々はほぼ間違いなく作者の意図を解釈できることと、この類の間違い表現はこの例が特別ではなく、しかも間違いだと気づかずに、結構日常使っているように思います。
更に、この文献には、格助詞が間違って使われた場合に読み手がそれをどう理解するかの研究「日本語における自動詞と名詞句との結合違反について」という興味深い内容もあります。