15

I had a post where I was asked to produce a MRE (Minimal, Reproducible Example). My case is such that I couldn't produce one, as the code having the compilation error was not faulty in itself. The environment seems to not be picking up some libraries for my code base.

The code (sub-project) has been compiled and tested in another environment successfully. The code snippet compiles as a new project successfully. Hence, an MRE is not viable.

This brings me to question its significance. Is it so that no problem can be solved w/o one? I've tried to explain the problem in a manner as best as I can. What can I add that could reduce the requirement of one?

25
  • 52
    SO contributors just don't have a reasonable guess why that code doesn't compile. When it compiles just fine for everybody. And you. They can't see the specific signal.h file you use, you didn't show the compile command, they don't know anything about how the "larger code base" is different. No shoes, no service. Try to get ahead by looking at signal.h, some odds that the declaration is wrapped with #ifdef. Commented May 30, 2019 at 11:16
  • 5
    I do agree to you that just saying "We need an [mcve]!" is not useful in this case. The request should've included some hints were to search for (I don't know C++, so ...) Commented May 30, 2019 at 11:23
  • 54
    OK, who thought up ' MRE' without Googling it first? Any new account who tries to look up the meaning will be served up... with pages of info about the gastronomic wonder that is US military field rations:( Commented May 30, 2019 at 11:25
  • 16
    @MartinJames thank Shog9 that at least it's not min-reprex only
    – VLAZ
    Commented May 30, 2019 at 12:06
  • 16
    This appears to be one of the first cases of new users being reprexed... :)
    – E_net4
    Commented May 30, 2019 at 13:08
  • 53
    Help, help, I'm being reprexed! Commented May 30, 2019 at 19:29
  • 7
    @MartinJames [mre] is expanded to minimal reproducible example. I doubt anyone is saying "you must include an MRE" without linking to the page. Beyond that, the other definition of MRE is an apt analogy. A prepackaged thing containing everything you need.
    – user4639281
    Commented May 30, 2019 at 19:51
  • 10
    @TinyGiant - MREs are minimally palatable and only eaten when there is no other choice. Should that be extended to our analogy? I shan't make such an example for my question until it's put on hold and I have no other choice? (only partially sarcastic. I only came to this question because I saw it and wondered 'why would someone need a meal ready to eat on stackoverflow?') Commented May 30, 2019 at 20:00
  • 8
    @TinyGiant tell it to Google. Anyone who has know idea what Shog was thinking will google it, see nothing but combat rations and wonder what the lunatics here are going on about. Commented May 30, 2019 at 20:02
  • 35
    @MartinJames Shog9 lives in a bunker after that reprex thing. So he's eating only those until it's safe to come out. Go easy on him...
    – Machavity Mod
    Commented May 30, 2019 at 20:07
  • 4
    @DanNeely most people commenting about MCVEs usually use the [mcve] magic link. I can't recall seeing any bare references to MCVE in recent history. Maybe it's more common in the tags you frequent, but it seems like a huge loss to omit the two square braces for the benefit of not having to type two characters. But I guess lazy People will always be lazy and there isn't much anyone can do about that. I'd say that any comment that requests an MCVE or MRE or MWE or what have you without linking to the help center page is worthless and should be deleted at best and actively harmful at worst.
    – user4639281
    Commented May 30, 2019 at 21:47
  • 4
    I actually had a case like this before. I cloned the repo to a new directory, and spent 3 days deleting code to eventually get a MRE. At the end of it, I had roughly 500 lines of code and a diagnosis for the problem.
    – Justin
    Commented May 30, 2019 at 22:23
  • 6
    @TinyGiant: I’ve seen quite a few people post “you need to include an MCVE”, they all were unaware they could write [mcve] and have it expand to a link. Commented May 31, 2019 at 0:36
  • 4
    @wovano: There are many shortcuts. Enjoy! Commented May 31, 2019 at 1:05
  • 3
    @TinyGiant can I have some proof of "most people commenting about MCVEs usually use the [mcve] magic link"? Because I certainly posted a request for a MCVE which I manually expanded and linked to like a chump because I never knew about the existence of magic links. Not until the whole min-reprex thing was posted and people mentioned it. I don't think how I'd ever pick it up - other syntax I can see if I edit a post, but I can't edit comments, nor can I see what code was used there. Nor did I even think there would be some sort of short-code for a link to something.
    – VLAZ
    Commented May 31, 2019 at 7:26

3 Answers 3

69

If you know that reproducing the error depends on the environment, you need to fully specify the environment that allows you to reliably do so. When something breaks in one environment but not another, then the environment itself is part of an MCVE. You'll need to specify operating system, compiler, required dependencies, installation options for those dependencies, modifications to PATH or any other environment variables, any required files on disk, the current directory when invoking the command, and any other environment details and changes that are required to reproduce it. You might need to set up a clean virtual machine to eliminate seemingly unrelated software or files that might be interfering with your work. You'll furthermore need to try to reduce the number of details you include by trying to narrow down which details cause the error; the most efficient way to try to do so is usually to introduce one change at a time (including undoing changes that you discover are extraneous) and test between each one.

I understand that narrowing down the relevant details and recording them in an easy to follow format are a lot of work, but imagine trying to do that work if you're trying to answer the question. If you're an answerer, you can only guess about what the asker's environment looks like; anything you try will be purely a shot in the dark. The people looking to answer your question are strangers who are graciously offering their time; it's not really very polite to ask them to chase down the problem without having any way to verify their ideas about the cause.

So if you haven't identified an environment that reproduces the error, then you're not done doing your research. You need to pursue those details before asking. Stack Overflow works best when you have identified all the necessary details, know exactly what detail is confusing to you, and are asking about that specific point of confusion.

Doing this may result in you discovering the answer yourself. If it's unintuitive and/or difficult to find information about it and you wish to save others (or possibly even yourself) trouble in the future, feel free to create the question and self-answer it. This sort of documentation is strongly encouraged by SO.

17
  • 1
    One thing I have done (more in a github PR, but would also work on SO) is provide a Vagrantfile / Dockerfile that reproduces the problem - that lets you bundle the 'environment' along with your example - that's a great way of allowing other people to see what is wrong - or 'rubber duck' yourself into figuring out what you missed!
    – Cinderhaze
    Commented May 31, 2019 at 12:50
  • 7
    @Cinderhaze I agree that Docker images or similar technologies are a great idea (especially for diagnosing and reproducing before you ask), but I would treat these like SQL Fiddles or the old off site JS Fiddles. They're very useful for demos, but the details of what goes into setting up the environment need to still be included in the question.
    – jpmc26
    Commented May 31, 2019 at 13:50
  • The problem here is that they did identify the environment, but it was not a source of the issue. More than likely it was an issue with some of the files not shown, as Hans points out. The entire preamble of this answer is addressing a concern which did not exist.
    – Travis J
    Commented May 31, 2019 at 19:18
  • 5
    @TravisJ The complete environment includes every single modified environment variable and every single file on disk. Whatever part of the environment was causing the issue was not included, so an MCVE had not yet been produced. I've updated the answer to explicitly point out the relevance of files on disk. Thanks.
    – jpmc26
    Commented May 31, 2019 at 19:21
  • I disagree with this answer. Unlike trimming down code to an MCVE, which can basically always be done formulaically, figuring out how to reproduce an environment in which an error occurs is often close to impossible - and figuring out the necessary details and including them in the question would frequently make the question a bizarre non-question whose answer is obvious. Yet a question of "what mysterious thing am I missing in my environment that is causing this error?" can be hugely useful to a broad audience. It's not useful to effectively disallow most questions in that class.
    – Mark Amery
    Commented Jun 26, 2019 at 16:51
  • 2
    @MarkAmery "figuring out how to reproduce an environment in which an error occurs is often close to impossible" Then how do you expect answerers who can't even access the environment to do it? "and figuring out the necessary details and including them in the question would frequently make the question a bizarre non-question whose answer is obvious" Which is fine if you're self answering to document the cause for future readers. The bottom line is that not doing this is just a refusal to do the work required to try to solve the problem, when in reality the author is the only one who can.
    – jpmc26
    Commented Jun 26, 2019 at 18:43
  • @jpmc26 "Then how do you expect answerers who can't even access the environment to do it?" - by having, y'know, actual detailed knowledge that the asker doesn't have, likely due to encountering the same error before and spending a day figuring it out.
    – Mark Amery
    Commented Jun 26, 2019 at 20:04
  • @MarkAmery I don't consider "spending a day figuring it out" anywhere near "close to impossible." For a question that difficult, you're not likely to get an answer within a day anyway, so you may as well do it yourself. An asker needs to have expertise in the subject before they ask in order to be able to determine the quality of their question. If they don't, they need to acquire it before asking so they can ensure it's not garbage. There are not enough highly skilled regular users to provide that level of expertise for every single question, so the duty falls to the asker.
    – jpmc26
    Commented Jun 26, 2019 at 20:58
  • 1
    @jpmc26 I don't consider "spending a day figuring it out" anywhere near "close to impossible." - sure - but what takes someone with detailed expertise a day could take someone without it weeks. There are not enough regular users to provide that level of expertise for every single question - okay, but so what? Then the question may not get an adequate answer. So be it. There shouldn't be a de facto requirement that all questions be trivially answerable by anyone.
    – Mark Amery
    Commented Jun 26, 2019 at 21:02
  • 1
    @MarkAmery So then it wastes the time of everyone who has to look at it and make that determination. How do you think we got the flood of bad questions we have? Because of this very unwillingness to understand the problem before asking. Do you realize how many bad questions would never get asked if askers actually researched their issue and tried things and made sure they understood the technology they're working with first?
    – jpmc26
    Commented Jun 26, 2019 at 21:03
  • @MarkAmery Furthermore, it's not our responsibility if someone has so little understanding of their toolset that they can't puzzle out an obscure problem. This just makes them unqualified at what they're doing. It's not up to us to fix that. Only they can do that by diving in and learning. Most likely, they're not going to be qualified to understand the answer if they get one anyway.
    – jpmc26
    Commented Jun 26, 2019 at 21:07
  • 1
    @jpmc26 Everything in your last two comments amounts to a fully general argument against anybody asking any question ever.
    – Mark Amery
    Commented Jun 26, 2019 at 21:08
  • 2
    @MarkAmery No. That is a strawman. It amounts to a drastic reduction in the number of questions we get and/or a drastic increase in self answered questions, which is exactly what we need. If someone obtains the expertise they need to be able to recognize that something confusing and difficult to figure out is going on (as opposed to trivial) and they can demonstrate the conditions that cause it, then it will probably be a good question that will benefit people in the future.
    – jpmc26
    Commented Jun 26, 2019 at 21:16
  • @MarkAmery Look at this question. There are tons of questions just like this one on SO. All of them stem from the user not knowing how binaries are found. Should we answer every single one of them, or should we expect that the user learns something about how binaries are found before they ask? If they don't even understand the concept of the system finding binaries, is it our job to individually teach every single asker that pops in with a question not solved by the numpy one?
    – jpmc26
    Commented Jun 26, 2019 at 21:24
  • 2
    @MarkAmery If we were more focused on having high quality questions written by people who know what they're doing, we'd probably have a nice canonical for that error instead and we wouldn't even need to debate about what to do with them. What we have as a result of not curating enough or being stringent on question quality is an unrefined garbage pile where it's difficult for people to even find the info they need if it exists at all.
    – jpmc26
    Commented Jun 26, 2019 at 21:27
29

You don't always need a reproducible example, so long as the problem can be described without it. The goal is to create a situation whereby a knowledgeable user can produce an answer to the question.

If such a user is required to create an entire example, and then solve the problem, then it is greatly beneficial to the question to first produce the example; without one, it is rare these questions get answers.

If such a user is required to guess at the problem, because the example does not exhibit the problem described, then the question will rarely get answers; users generally do not guess unless they are fairly certain they are correct.

In this case, since enough users who were well informed in the subject could not reproduce the issue you describe, given the situation you provide, the requirement to produce more information lands solely with you, the question asker.

Questions need to be able to be answered to be on topic, and in order for an answer to be produced, there needs to be a viable scenario produced which exhibits whichever problem is being encountered.

How to get to a reproducible example can be difficult, and often leads to solving the problem on your own. I would suggest that you keep working to provide a way to reproduce the problem, and if you do get to that point but cannot solve the problem, at least other users will be able to take part in observing the problematic behavior.

4
  • 2
    "the requirement to produce more information lands solely with you, the question asker." - and that includes you ( the question asker ) working out what extra information is required.
    – Stephen C
    Commented May 31, 2019 at 2:18
  • 4
    I've downvoted this because it offered absolutely no advice that the user could actually put into practice to improve their question. Other than maybe what amounts to, "keep banging your head against the wall."
    – jpmc26
    Commented May 31, 2019 at 4:11
  • 4
    @jpmc26 - That is because the title was edited after my answer. The original title read "what is the significance of an MRE". Since you seem to only read the title though, I am curious if you even read the post itself, or even my answer. I see you simply added "check the environment" and a weak paraphrasing of this exact answer (thank you by the way, emulation is the highest form of flattery). I also disagree that doing research or debugging is akin to self harm. We are not in the business of handing out A's for effort here.
    – Travis J
    Commented May 31, 2019 at 4:47
  • 3
    My answer is not a weak paraphrase. It's a direct challenge to their misunderstanding of what comprises an MCVE and a clear statement of what details they need to provide to have created one. Yours just tells the user to "keep working to provide a way to reproduce the problem," without telling them what to work on. Your opening statement also wrongly leaves one with the impression that an MCVE is not required to resolve the source of an error. Your assertion that users rarely guess is also wrong; I see it frequently on Python questions about importing modules or installing packages.
    – jpmc26
    Commented May 31, 2019 at 5:06
4

It's actually pretty simple. If we cannot reproduce the problem you have, then you have not specified the problem enough to be reproducible.

It's a good question though. Maybe this should be clarified on the help page for mre that the compiler commands and other similar things also counts.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .