sztosz
Erlang :dets.open_file error I can't understand and fix
iex(1)> :dets.open_file("dets/definitions_agent", type: :set)
dets: file <<"dets/definitions_agent">> not properly closed, repairing ...
{:EXIT,
{:function_clause,
[
{:lists, :thing_to_list, ["dets/definitions_agent"],
[file: 'lists.erl', line: 603]},
{:lists, :flatmap, 2, [file: 'lists.erl', line: 1250]},
{:dets, :tempfile, 1, [file: 'dets.erl', line: 2786]},
{:dets, :fsck_try, 5, [file: 'dets.erl', line: 2750]},
{:dets, :fsck, 6, [file: 'dets.erl', line: 2727]},
{:dets, :do_repair, 7, [file: 'dets.erl', line: 2597]},
{:dets, :do_open_file, 4, [file: 'dets.erl', line: 2125]},
{:dets, :do_internal_open, 5, [file: 'dets.erl', line: 1609]},
{:dets, :init, 2, [file: 'dets.erl', line: 1285]},
{:proc_lib, :init_p_do_apply, 3, [file: 'proc_lib.erl', line: 247]}
]}}
Can someone translate this error or tell me what is going on? 
It occurs only when dets table dets/definitions_agent was not closed properly, but from the dets documentation looks like it should repair itself… but instead I get this error and I’m unable to decipher it.
Marked As Solved
cmkarlsson
Ok, looks like a regression. I filed a bug report about this in Erl 18. (https://bugs.erlang.org/browse/ERL-55) it was fixed in Erl 19, but seems to no longer work in Erl 20.
Try using charstring instead of binary string when you open the file.
The bug was hard to spot because using binary string works to open a clean file, but not if a file has to be repaired.
This works for me with OTP 20 / Iex 1.6.4
:dets.open_file('dets/definitions_agent', type: :set)
dets: file "dets/definitions_agent" not properly closed, repairing ...
2
Popular in Questions
Erlang/OTP 25 [erts-13.2.2] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1]
15:22:35.803 [error] gen_event {lager_file_backend...
New
In Ruby, I can go:
User.find_by(email: "foobar@email.com").update(email: "hello@email.com")
How can I do something similar in Elixir? ...
New
I’m hoping you guys can give me some general advice and perhaps code examples if you’re feeling up to it.
I’m very interested in Elixir,...
New
I am VERY much an elixir newbie. I have taken one elixir course and one phoenix course on Udemy. During that course, I saw the instructor...
New
Hello,
I am trying to convert my lists to string without losing brackets.For start i have 3 map. They look like these
buyer = %{
id: ...
New
To simplify some tasks at work, I wrote and published this package yesterday. It’s a simple macro that enables Access behaviour on struct...
New
Can someone explain the settings of pool_size of Ecto in config file? and what is the recommend size?
Thanks
New
I have a super simple question about elixir - how would I take a file like this
foo bar baz
and output a new file that enumerates th...
New
Hi everyone!
I need implement if…else if…else condition from my elixir code, and anymore of this control flow structures not work proper...
New
I’ve been re-reading swift book again and noticed that multiline strings there don’t have a trailing line break, unlike in elixir
iex(2)...
New
Other popular topics
Manning 2016 Halloween weekend sale via Deal of the Day
Friday, October 28 - Half off all MEAPs - code WM102816LT
Saturday, October 29 ...
New
Hi folks,
Few months ago I have announced the proof-of-concept of the library to manipulate the browsers DOM objects directly from Elixi...
New
As many of you may have realized by now (sorry for all the posts here) I’ve been working on a db problem where I’m trying to aggregate a ...
New
Could someone help me? I'm making my first elixir program, number guessing game. I can't figure out how to convert the user's guess from ...
New
I have a another noob question about loop. Since elixir is immutable, while loop is not directly possible.
total = 10
while total != 0
...
New
I have a User schema with a :from_id field set to type :string:
defmodule TweetBot.Repo.Migrations.CreateUsers do
use Ecto.Migration
...
New
Hi all,
I've just started learning Elixir and Phoenix Framework, so please pardon my n00bness at this stage.
I'm trying to use Postg...
New
This post is an instruction guide to help you setup your Neovim for Elixir development from scratch. It includes general information on h...
New
Elixir appears to be a superior language to Python. I don’t see any advantage of Python over Elixir. Are there any?
New
Hey :wave:t3: Elixir community,
I’ve been learning Elixir, and working on some side projects. My editor of choice is VSCode, and althoug...
New







